new collision manifolds

Post Reply
Andy Somogyi
Posts: 5
Joined: Mon Apr 24, 2017 6:53 pm

new collision manifolds

Post by Andy Somogyi »

I'm writing an article about using bullet, and I'd like to make sure my understanding of bullet's collision algorithm is correct, and I've got a few questions about how bullet allocates collision manifolds.

The broadphase first calculates a list of potential contacts via the AABB collision step. Then, looking at the call stack, we have:

Code: Select all

btCollisionDispatcher::dispatchAllCollisionPairs
btHashedOverlappingPairCache::processAllOverlappingPairs
btCollisionPairCallback::processOverlap
btCollisionDispatcher::defaultNearCallback
btCollisionDispatcher::findAlgorithm
Here we get to: btCollisionDispatcher.cpp:159

Code: Select all

m_doubleDispatchContactPoints[...][...]->CreateCollisionAlgorithm(ci, body0Wrap, body1Wrap);
Here we get to btCollisionAlgorithmCreateFunc::CreateCollisionAlgorithm.
This function calls the constructor for the collision algorithm. Each collision algorithm constructor calls the dispatcher's getNewManifold method to create a new collision manifold.

Correct me if I'm wrong, but the implication of this is that a new collision algorithm is created for each potential collision pair, and in turn, a new collision manifold is created for each potential collision pair.

Wouldn't it be more efficient to only create a new collision manifold if the potential collision pair from the broadphase actually results in a true collision? What happens to the newly allocated collision manifolds in the dispatcher if the potential collision ends up getting rejected?

Also, it looks like the btCollisionAlgorithm::processCollision (... btManifoldResult*) btManifoldResult gets ignored in nearly all of the collision callbacks. Question: if this gets ignored, would it make the code clearer and more effecient if this parameter was removed?

Thanks
Post Reply