Right now I have a concave shape and want to know contact information (enough to separate it) from a static triangle mesh. As of this point, I am able to handle contacts between concave shapes pretty easily (using a penetration depth solver) but not with the triangle mesh.
After creating the btBvhTriangleMeshShape and applying it to a btCollisionObject, I add it to the world. So this is what my chunk of code looks like when I'm searching for collision information between concave and convex (in this example there are only two objects in the world, a convex and concave):
Code: Select all
pColWorld->performDiscreteCollisionDetection();
// get the number of manifolds (contact sets) that occured
const int numManifolds = Locals.pColWorld->getDispatcher()->getNumManifolds();
for (int i(0); i < numManifolds; ++i)
{
// get the manifold
btPersistentManifold *pManifold = pColWorld->getDispatcher()->getManifoldByIndexInternal(i);
// get collision objects
btCollisionObject *pColBodyA = static_cast<btCollisionObject*>(pManifold->getBody0());
btCollisionObject *pColBodyB = static_cast<btCollisionObject*>(pManifold->getBody1());
int numPoints = pManifold->getNumContacts();
if (!pColBodyA->getUserPointer() || !pColBodyB->getUserPointer())
{
btCollisionAlgorithm *pAlgo =
Locals.pColWorld->getDispatcher()->findAlgorithm(pColBodyA, pColBodyB, pManifold);
btManifoldResult result(pColBodyA, pColBodyB);
pAlgo->processCollision(pColBodyA, pColBodyB, Locals.pColWorld->getDispatchInfo(),
&result);
}
So looking for any help on how to approach this.