I have a world with multiple kinematic bodies and I want to be able to find all contact points between them. If I do something like:
Code: Select all
m_dynamicsWorld->stepSimulation(dt);
int numManifolds = m_dynamicsWorld->getDispatcher()->getNumManifolds();
for (int i = 0; i < numManifolds; i++) {
btPersistentManifold* manifold = m_dynamicsWorld->getDispatcher()->getManifoldByIndexInternal(i);
...
I do get sensible looking manifolds and contact points, but the contact points shift slightly every frame. So for example, if I have a capsule intersecting the floor, I find the contact point and use it to "correct" the capsule location and move it up so that its sitting on top of the floor. On the next frame I move the capsule down again with some fake gravity and get another contact, but the contact point on the floor is slightly different so moving the capsule back to this position results in noticeable jittering.
I tried doing a capsule sweep instead, and get consistent results each time - I can set the capsule position to the sweep contact point and it's stable. Is there something different about how a sweep works, should I not be using the dispatcher manifolds in this way?