Fixed bug with multiple collider removals

This commit is contained in:
Diren D Bharwani 2022-10-26 16:55:28 +08:00
parent 4f28161e45
commit 12758878c5
1 changed files with 3 additions and 1 deletions

View File

@ -575,7 +575,9 @@ namespace SHADE
if (REMOVED_ID == COLLIDER_ID)
{
// Remove all colliders
for (uint32_t i = 0; i < physicsObject->rp3dBody->getNbColliders(); ++i)
const int NUM_COLLIDERS = static_cast<int>(physicsObject->rp3dBody->getNbColliders());
for (int i = NUM_COLLIDERS - 1; i >= 0; --i)
{
auto* collider = physicsObject->rp3dBody->getCollider(i);
physicsObject->rp3dBody->removeCollider(collider);