[ODE] Center of mass problem

Jon Watte (ODE) hplus-ode at mindcontrol.org
Wed Jan 10 22:36:13 MST 2007


As documented in the documentation (and, at this point, the FAQ), the 
mass offset/translation is ignored when set on a body. The center of the 
body is always the center of gravity. If you want an off-center shape, 
then you offset the geom from that center of gravity.

Btw: when I had a totally unexplainable capsule rotation problem in my 
own code several years back, it turned out to have been caused by my 
forgetting that ODE quaternions are in the order WXYZ, while most 
rendering libraries use XYZW, so while the quaternion I rendered was 
normalized, it was not correctly representing the actual orientation. 
Another, similar problem that may arise is that ODE matrices are laid 
out differently from how DirectX and OpenGL lays them out in memory 
(it's transposed in memory).

Cheers,

/ h+


Tim Sorrells wrote:
>
> Alright so I have a capsule that keeps wanting to stand up on one end, 
> rather than settle down lengthwise and look like a real world object. 
> As I understand it the dMassTranslate function moves a mass relative 
> to its body (although I honestly would love to simply point it at a 
> geom and not have to configure it separately). I give my geom a 
> <0.0,0.0,0.25> offset and then I try to move the mass to the center of 
> the object by giving it a translate of <0,0,0.25>. But my capsule 
> keeps standing up. I’ve tried changing around all the various x,y,z 
> params to dMassTranslate and while they produce a variety of unwanted 
> effects, nothing I’ve tried will get my capsule to act like a balanced 
> capsule.
>
> Here’s the order of operations, since I’ve noticed ODE is very 
> unforgiving if you call functions out of order:
>
> // Spawn body and setup geom
>
> dGeomSetBody()
>
> dGeomSetOffsetWorldPosition()
>
> dGeomSetOffsetWorldRotation()
>
> dMassSetCapsuleTotal()
>
> dMassTranslate()
>
> dBodySetMass()
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ODE mailing list
> ODE at ode.org
> http://mooshika.org/mailman/listinfo/ode


More information about the ODE mailing list