Hi there.
I have a thorny problem.
I have a wall(triangle mesh) and I need to figure out which parts of the wall have been colliding with a cone. Is there a way to retrieve a list of the triangles that are colliding with the Cone?
Is there another way to do this?
Getting list of triangles involved in collision.
-
- Posts: 11
- Joined: Mon Nov 02, 2009 11:55 am
-
- Posts: 11
- Joined: Fri Oct 19, 2012 3:37 am
Re: Getting list of triangles involved in collision.
Hi, I have the same problem. Does Bullet support this or not?
I found in the manual, a callback function
virtual btScalar btCollisionWorld::ContactResultCallback::addSingleResult ( btManifoldPoint & cp,
const btCollisionObject * colObj0,
int partId0,
int index0,
const btCollisionObject * colObj1,
int partId1,
int index1
)
In this function, the index0 and index1 is the index of colliding triangles, or not?
I found in the manual, a callback function
virtual btScalar btCollisionWorld::ContactResultCallback::addSingleResult ( btManifoldPoint & cp,
const btCollisionObject * colObj0,
int partId0,
int index0,
const btCollisionObject * colObj1,
int partId1,
int index1
)
In this function, the index0 and index1 is the index of colliding triangles, or not?
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Getting list of triangles involved in collision.
Yes you can use a callback to find the actual triangle (and part) index.
The index and partId points to the triangle index and (optional) part of a triangle mesh, in case you are using btBvhTriangleMeshShape.
Note that it is best to use Bullet-2.81, the interface changed slightly:
The index and partId points to the triangle index and (optional) part of a triangle mesh, in case you are using btBvhTriangleMeshShape.
Note that it is best to use Bullet-2.81, the interface changed slightly:
Code: Select all
static bool ContactAddedCallback(btManifoldPoint& cp, const btCollisionObjectWrapper* colObj0Wrap,int partId0,int index0,const btCollisionObjectWrapper* colObj1Wrap,int partId1,int index1);