[ODE] center of mass problems

Jon Watte hplus-ode at mindcontrol.org
Fri Dec 10 09:32:35 MST 2004


 >  I'm trying to do some simulations of a body with the center of mass that is not at the center of the body.

 
 
There is no such thing. In ODE, the center of the body is defined as 
the center of mass. If the center of the geometric extent is somewhere 
else, then you use a dGeomTransform (typically in mode 1) to offset 
the geometric extent from the center of mass.


Your code:

geom[0] = dCreateGeomTransform(0); /*encapsulated geom*/
dGeomSetPosition(geom[0],0.5f,0.0f,1.0f); /*the offset, basically the position of the center of mass*/
geom[1] = dCreateGeomTransform(space); /*my transform geom*/
dGeomTransformSetGeom (geom[1],geom[0]);
dGeomTransformSetCleanup (geom[1],0); 
dGeomSetBody (geom[1], body);


The first part is wrong -- you're putting a GeomTransform inside a 
GeomTransform. You probably want to put a Box, or a Sphere, or 
whatever as geom[0], inside the geom[1] GeomTransform.


Cheers,

		/ h+




More information about the ODE mailing list