Tips for mass of children that compose a CompoundBody?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
BrianL
Posts: 54
Joined: Wed Jun 25, 2008 4:41 pm
Location: Panama City Beach, FL

Tips for mass of children that compose a CompoundBody?

Post by BrianL »

I've noticed that if I specify masses that are too small for the children of a CompoundBody, then the Entity representing the CompoundBody ends up with a bunch of NaNs in various member variables. From what I can tell, the only thing that really affects (prevents) it, is increasing the mass of the children.

If I don't specify a mass, and the child defaults to infinity, that also causes a problem. In my particular case, I'm only adding one child to the CompoundBody and the mass is a reasonable (or so I thought) 1.0f.

Just looking for some general guidelines regarding this. Thanks.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Tips for mass of children that compose a CompoundBody?

Post by Norbo »

Not specifying a mass creates a kinematic object which cannot respond to forces (infinite mass).

Adding a single body of mass = 1 to a compound body should not cause any issues; as long as you stay within a fairly normal range of masses for your objects (large mass differences between colliding objects can make it hard on the velocity solver) it should work fine.

Unfortunately, there is a problem with the way the CompoundBody inertia tensor is computed. I just fixed this for v0.10.0 but in the mean time using a stand-in inertia tensor for when you encounter problems like this will work well enough. After you set up your compound body, create a Box with dimensions equal to the bounding box of your compound body and appropriate mass. Set the localSpaceInertiaTensor of the CompoundBody to that of the box's localSpaceInertiaTensor. This obviously won't be exactly right, but will be good enough for many situations.
Post Reply