[ODE] Center of Mass not at (0, 0, 0)

Geoff Carlton gcarlton at iinet.net.au
Wed Sep 13 16:41:27 MST 2006


>> you have to re-calculate where the center of mass is and the 
>> re-shift/offset all of your geoms, which would lead to the human body 
>> actually being shifted around on the screen, i.e: this solution would 
>> not work. 
This is fairly easy to do:
  oldpos = dGeomGetPosition(g)
  oldrot = dGeomGetRotation(g)
  dBodySetPosition(b, (x,y,z))
  dGeomSetOffsetWorldPosition(g, oldpos)
  dGeomSetOffsetWorldRotation(g, oldrot)

The last two functions move the geom via the offset, keeping the body in 
its existing position.  All in all, body as "centre" and geom is "what 
you see" makes sense once you are used to it.

Geoff


More information about the ODE mailing list