[ODE] Locators - Center of mass

Geoff Carlton gcarlton at iinet.net.au
Thu Sep 14 20:22:30 MST 2006

selwakad at comcast.net wrote:
> having the center of mass not equal to the body origin is a great idea.
> it will make it possible to integrate keyframe animations with physics.
Two main problems are:
1.) There is nothing gained except a bit of convenience.
2.) It would add overhead to all users.  (I think).

If you look back on discussions with geom offsets, you will see that 2 
is a killer.  It means it just won't happen.

Now, consider a 1m high barrel sitting on the floor, with some liquid in it:
  geom pos = cylinder centre = (0, 0, 0.5)
  body pos = centre-of-mass = (0, 0, 0.35) 
But you might want to measure entities from their "feet".  Well, you'll 
need to store an offset and do this:
  my pos = geom.pos + geom.R * (0, 0, -0.5)

But then you might have a panel on the side that is generating sparks.  
That is a second point, one with rotational significance.  Perhaps a 
crane picks up the barrel near the lid, requiring a third location point.

Well, if we are going to make it easier to do one of these, we may as 
well support them all.  One way would be for a new type of geom, a 
"locator" or "location" type.  You'd create these in a null space, 
attach them to the body, and not collide them with anything.  Using 
existing geom offsets it would then make it trivial to get their real 
world position.  The advantages of this are:

1.) Supports more than one "special" location point.
2.) Supports rotation as well as position.
3.) Supports dynamic adding and removing of locations.
4.) Shares much of the same offset API and has all the support functions 
for world/offset getting/setting.
5.) It is a very simple change, as it hooks into the existing offset 
code and is a pure addition.
6.) Fairly CPU efficient, it only recalculates orientation when dirty, 
also returns position etc by reference.
7.) Fairly memory efficient, it stores the offset+final posr as well as 
some extra geom housekeeping.  For cases where the locator is at the 
body's origin it doesn't even store the transforms.  Unfortunately it 
does store the rotational part even for pure positional locators.
8.) Zero overhead for other users.

The only issue with this is it doesn't make things "just work" (I want 
my barrel at (0,0,0) dammit!).  But for real world cases, it seems 
pretty useful.


More information about the ODE mailing list