fix issue related to addConstraint/removeConstraint, introduced by filtering collision between two particular bodies

https://github.com/bulletphysics/bullet3/issues/173
This commit is contained in:
erwincoumans
2014-05-17 14:24:22 -07:00
parent 1e2b907562
commit 2601932249
2 changed files with 19 additions and 14 deletions

View File

@@ -653,6 +653,9 @@ void btDiscreteDynamicsWorld::updateActivationState(btScalar timeStep)
void btDiscreteDynamicsWorld::addConstraint(btTypedConstraint* constraint,bool disableCollisionsBetweenLinkedBodies)
{
m_constraints.push_back(constraint);
//Make sure the two bodies of a type constraint are different (possibly add this to the btTypedConstraint constructor?)
btAssert(&constraint->getRigidBodyA()!=&constraint->getRigidBodyB());
if (disableCollisionsBetweenLinkedBodies)
{
constraint->getRigidBodyA().addConstraintRef(constraint);