remove constraints from world, if not done yet
authorErwin Coumans <blender@erwincoumans.com>
Sat, 11 Oct 2008 19:32:53 +0000 (19:32 +0000)
committerErwin Coumans <blender@erwincoumans.com>
Sat, 11 Oct 2008 19:32:53 +0000 (19:32 +0000)
extern/bullet2/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp

index 329a1d9cde3671b7d12400dee453b6d233719ce2..745694e2f70f202e127ef279f26046e20367b67b 100644 (file)
@@ -423,6 +423,13 @@ btVector3 btDiscreteDynamicsWorld::getGravity () const
 
 void   btDiscreteDynamicsWorld::removeRigidBody(btRigidBody* body)
 {
+       //remove all constraints too
+       while (body->getNumConstraintRefs())
+       {
+               btTypedConstraint* constraint = body->getConstraintRef(0);
+               removeConstraint(constraint);
+       }
+
        removeCollisionObject(body);
 }