get list of collision pairs
Posted: Fri Apr 13, 2012 4:20 am
Can you please tell how to Bullet can get a list of objects of class btRigidBody, collided with this object.
Sorry for my google.translate)
Sorry for my google.translate)
Code: Select all
const int manifoldCount(dispatcher.getNumManifolds());
for(int loop = 0; loop < manifoldCount; loop++) {
const btPersistentManifold *mf = dispatcher.getManifoldByIndexInternal(loop);
const void *obja = mf->getBody0();
const void *objb = mf->getBody1();
if(obja == object || objb == object) {
// This manifold deals with the btRigidBody we are looking for.
// A manifold is a RB-RB pair containing a list of potential (predicted) contact points.
const unsigned int numContacts(mf->getNumContacts());
for(int check = 0; check < numContacts; check++) {
const btManifoldPoint &pt(mf->getContactPoint(check));
// do something here, in case you're interested.
}
}
}