Collision Vertex/Triangle Index

Post Reply
deian
Posts: 1
Joined: Thu Apr 11, 2013 9:38 am

Collision Vertex/Triangle Index

Post by deian »

Hi,

i am using the bullet collision detection exclusively for triangle meshes. More specifically the GImpact Algorithm.
From the tutorials on the bullet wiki i can deduce how to perform the collision tests and hot to get the contact coordinates.
Now my question is: is there a possibility to get the collided vertex/triangle indices and in case the according barycentric coordinates?

regards

Code: Select all


btCollisionObjectWrapper wrap_(NULL, s_.shape(), s_.obj(), s_.obj()->getWorldTransform());
btCollisionAlgorithm* algo  = m_dispatcher.findAlgorithm(&wrap, &wrap_);
btManifoldResult contactPointResult(&wrap, &wrap_);
algo->processCollision(&wrap, &wrap_, info, &contactPointResult);

btManifoldArray manifoldArray;
algo->getAllContactManifolds(manifoldArray);

for (int i(0); i < manifoldArray.size(); ++i) {

	btPersistentManifold* manifold = manifoldArray[i];
	int n_con = manifold->getNumContacts();
	for (int j(0); j < n_con; ++j) {

	       btManifoldPoint& pt = manifold->getContactPoint(j);
	       btVector3 a_ = pt.getPositionWorldOnA();
	       btVector3 b_ = pt.getPositionWorldOnB();
	       btVector3 f_ = pt.m_normalWorldOnB;
               // VERTEX/TRIANGLE INDEX ??
        }
}
Post Reply