Computing penetration depth from btBvhTriangleMeshShape

Nacho
Posts: 31
Joined: Tue Mar 04, 2008 1:41 pm

Computing penetration depth from btBvhTriangleMeshShape

Post by Nacho »

How can I compute penetration depth between a convex shape and btBvhTriangleMeshShape?

Between two convex shapes, I use btGjkPairDetector, but it is no available for concave shapes.

Thanks in advance.
Nacho
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Computing penetration depth from btBvhTriangleMeshShape

Post by sparkprime »

I believe you find the right triangle in the mesh, and then the triangle is convex so it's just a convex-convex. However I don't know what I'm talking about.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Computing penetration depth from btBvhTriangleMeshShape

Post by Erwin Coumans »

Nacho wrote:Between two convex shapes, I use btGjkPairDetector, but it is no available for concave shapes.
As sparkprime already mentioned, it boils down to a series of convex-triangle collisions indeed. You just need to implement a triangle-convex callback:

Code: Select all

 concaveShape->processAllTriangles( &convexTriangleCallback,cmAabbMin,cmAabbMax);
Note that this aabb is the aabb of the convex shape transformed into the coordinate system of the trianglemesh shape. This has been implemented in bullet\src\BulletCollision\CollisionDispatch\btConvexConcaveCollisionAlgorithm.cpp

Hope this helps,
Erwin
Nacho
Posts: 31
Joined: Tue Mar 04, 2008 1:41 pm

Re: Computing penetration depth from btBvhTriangleMeshShape

Post by Nacho »

Thanks!

Nacho