http://www.bulletphysics.org/mediawiki- ... d_Triggers
Looking at the documentation, I see a manual way to iterate through collision contacts is available:
My thing is I don't know if these contacts are going to be generated for a kinematic rigid body, without some special trickery. Moreover, I would have to iterate over all the contacts and find the contacts that correspond to the rigid body I want, and then handle the collisions, which seems potentially slow and inefficient.//Assume world->stepSimulation or world->performDiscreteCollisionDetection has been called
int numManifolds = world->getDispatcher()->getNumManifolds();
for (int i=0;i<numManifolds;i++)
{
btPersistentManifold* contactManifold = world->getDispatcher()->getManifoldByIndexInternal(i);
btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0());
btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1());
int numContacts = contactManifold->getNumContacts();
for (int j=0;j<numContacts;j++)
{
btManifoldPoint& pt = contactManifold->getContactPoint(j);
if (pt.getDistance()<0.f)
{
const btVector3& ptA = pt.getPositionWorldOnA();
const btVector3& ptB = pt.getPositionWorldOnB();
const btVector3& normalOnB = pt.m_normalWorldOnB;
}
}
}
So maybe I want a way to quickly check for all collisions against my particular object? Or maybe, since there may be several such objects in the scene, its more efficient to compute all the contacts together in one fell swoop.
Please advise!