BGE: Fix Rigid body constraint deletion

Fix for T41294.
Rigid body constraints are not deleted, if the corresponding game objects are deleted.

Reviewers: moguri

Differential Revision: https://developer.blender.org/D701
This commit is contained in:
2014-12-02 19:25:06 -08:00
committed by Mitchell Stokes
parent 5996ad2fd4
commit 47ebf96de4

View File

@@ -504,9 +504,9 @@ bool CcdPhysicsEnvironment::RemoveCcdPhysicsController(CcdPhysicsController* ctr
btRigidBody* body = ctrl->GetRigidBody();
if (body)
{
for (int i=body->getNumConstraintRefs()-1;i>=0;i--)
for (int i = m_dynamicsWorld->getNumConstraints()-1;i>=0;i--)
{
btTypedConstraint* con = body->getConstraintRef(i);
btTypedConstraint *con = m_dynamicsWorld->getConstraint(i);
m_dynamicsWorld->removeConstraint(con);
body->removeConstraintRef(con);
//delete con; //might be kept by python KX_ConstraintWrapper