triangles in a rectangular box

jjj
Posts: 3
Joined: Fri Apr 18, 2008 6:45 pm

triangles in a rectangular box

Post by jjj »

Is there any way in bullet that allows me to get triangle indices in a triangle mesh contained in a given rectangular box? If not, how can I modify the source to do so.

Thank you in advance.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: triangles in a rectangular box

Post by Erwin Coumans »

Yes, you can implement your triangle callback (derived from btTriangleCallback), and call the triangle mesh processAllTriangles. For each triangle that overlaps your box (aabbMin/aabbMax) a callback to processTriangle is performed:

Code: Select all

 virtual void processTriangle(btVector3* triangle,int partId, int triangleIndex)
See Bullet/Demos/OpenGL/GL_ShapeDrawer.cpp for an example how to use

Thanks,
Erwin