manually removing contact manifolds was a bad idea

This commit is contained in:
Andrew Meadows 2016-02-10 12:06:44 -08:00
parent 532f0683e8
commit fed03edde3

View file

@ -412,7 +412,6 @@ void PhysicsEngine::bumpAndPruneContacts(ObjectMotionState* motionState) {
assert(motionState);
btCollisionObject* object = motionState->getRigidBody();
std::vector<btPersistentManifold*> staleManifolds;
int numManifolds = _collisionDispatcher->getNumManifolds();
for (int i = 0; i < numManifolds; ++i) {
btPersistentManifold* contactManifold = _collisionDispatcher->getManifoldByIndexInternal(i);
@ -427,7 +426,6 @@ void PhysicsEngine::bumpAndPruneContacts(ObjectMotionState* motionState) {
objectA->setActivationState(ACTIVE_TAG);
}
}
staleManifolds.push_back(contactManifold);
} else if (objectA == object) {
if (!objectB->isStaticOrKinematicObject()) {
ObjectMotionState* motionStateB = static_cast<ObjectMotionState*>(objectB->getUserPointer());
@ -436,13 +434,9 @@ void PhysicsEngine::bumpAndPruneContacts(ObjectMotionState* motionState) {
objectB->setActivationState(ACTIVE_TAG);
}
}
staleManifolds.push_back(contactManifold);
}
}
}
for (auto manifold : staleManifolds) {
_collisionDispatcher->releaseManifold(manifold);
}
removeContacts(motionState);
}