Using btGeometryUtils and btShapeHull for btConvexHullShapes

kate
Posts: 41
Joined: Thu Jan 08, 2009 11:20 am
Location: London, UK

Using btGeometryUtils and btShapeHull for btConvexHullShapes

Post by kate »

Hi,

I'm getting myself into a bit of a knot with btConvexHullShapes; if someone can help me untangle, I'd appreciate it :)

I'm generating the collision shapes from existing meshes, which may need to be simplified using the btShapeHull utility (I've been passing it a btTriangleMesh), which has been fine, but recently I've changed the world scale, and found that the collision margin is a bit big now and leaves a noticable gap between objects.

So, I'm trying to use the btGeometryUtil functions to reduce the collision surface size to take the margin into account (as described in this thread). This is fine when I use simple objects, but when I have objects with many vertices, it takes quite a long time...

So, OK, I use the btGeometryUtil functions after I've used the btShapeHull - but the btGeometryUtil returns more vertices than it is given sometimes (in one case I got 720 from it). Which means that I'd need to use the btShapeHull again. Which seems a bit convoluted to me...

Am I going about this the right way - or is there something I've missed?!

Many thanks,

Kate
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Using btGeometryUtils and btShapeHull for btConvexHullShapes

Post by Erwin Coumans »

Hi Kate,

Are you happy with the end result, despite the overly complicated and cumbersome steps?

complex concave triangle mesh -> btShapeHull to create convex hull with reduced # vertices -> shift planes to compensate for collision margin (could introduce more vertices again) -> btShapeHull to reduce # vertices again

Can you wrap all those those steps in a single utility class, using some temporary buffers to store the in-between results? If so, we welcome a contribution for such utility :)
Thanks,
Erwin
kate
Posts: 41
Joined: Thu Jan 08, 2009 11:20 am
Location: London, UK

Re: Using btGeometryUtils and btShapeHull for btConvexHullShapes

Post by kate »

Hi Erwin,

The end result is OK, but it does take a long time to generate the meshes now, even for simple shapes, when there are lots of objects in the scene. I'll probably need to find a faster method, and/or a way to generate a more accurate convex hull (as I'm not sure that 42 vertices are enough to represent a sufficiently complex shape for our purposes...).

If I do make something useful, I'd be happy to share it - but I'll have to check whether my company policy would allow that; I suspect it may not, sorry :( .

Kate