List of hit triangles

Spaddlewit
Posts: 28
Joined: Fri Sep 04, 2009 8:23 pm

List of hit triangles

Post by Spaddlewit »

I've got a sphere and a triangle mesh.
When the sphere hits the triangle mesh, I want to obtain a list of the triangles that were hit. Is this possible? Do I do this in a custom narrowphase callback? If so, how? I already have the narrowphase callback working, I just need to know how to get the triangles.
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: List of hit triangles

Post by pico »

It would be great if bullet could provide/generate a list of clipped triangles for a convex cast. In this way geometric decals could be generated with Bullet.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: List of hit triangles

Post by Erwin Coumans »

Spaddlewit wrote:I've got a sphere and a triangle mesh.
When the sphere hits the triangle mesh, I want to obtain a list of the triangles that were hit. Is this possible?
You can use the btConcaveShape::processAllTriangles method, and pass in a triangle callback and a axis aligned bounding box (AABB). The triangle callback will be called for each triangle of the mesh that has AABB overlap.

Hope this helps,
Erwin
It would be great if bullet could provide/generate a list of clipped triangles for a convex cast. In this way geometric decals could be generated with Bullet.
Good idea. Please file a feature request in the issue tracker, before it gets lost deep in the forum.
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: List of hit triangles

Post by pico »

Hi Erwin,

feature request has been added:

http://code.google.com/p/bullet/issues/detail?id=272

Thanks for taking care!