Fix issue in PhysicsWorld::destroyRigigBody() method

This commit is contained in:
Daniel Chappuis 2021-09-24 17:10:10 +02:00
parent 9e3cb9824e
commit 3e7b990a07

View File

@ -521,9 +521,8 @@ void PhysicsWorld::destroyRigidBody(RigidBody* rigidBody) {
// Destroy all the joints in which the rigid body to be destroyed is involved // Destroy all the joints in which the rigid body to be destroyed is involved
const Array<Entity>& joints = mRigidBodyComponents.getJoints(rigidBody->getEntity()); const Array<Entity>& joints = mRigidBodyComponents.getJoints(rigidBody->getEntity());
const uint32 nbJoints = joints.size(); while (joints.size() > 0) {
for (uint32 i=0; i < nbJoints; i++) { destroyJoint(mJointsComponents.getJoint(joints[0]));
destroyJoint(mJointsComponents.getJoint(joints[i]));
} }
// Destroy the corresponding entity and its components // Destroy the corresponding entity and its components