Volume and density of collision shapes

kickvb
Posts: 6
Joined: Wed Dec 09, 2009 5:05 pm

Volume and density of collision shapes

Post by kickvb »

I would like to specify the masses of the rigid bodies from their density. I searched a way to find the volume of collision shapes but haven't find anything about that. It is easy to compute them for primitive shapes, but this is harder for custom shapes.

Is there a way to do that?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Volume and density of collision shapes

Post by Erwin Coumans »

There is no way to do that right now.

Generally we avoid calculating the mass from the density, because the default Bullet constraint solver (similar to many other game physics libraries) doesn't work well when objects with large mass differences/ratios interact. So we artificially keep the mass of moving objects objects in a safe range (from 1 to 100 kilogram for example).

One way to approximate the volume is to voxelize the interior of objects using small spheres/cubes, and then take the sum of them.
Cheers,
Erwin