[ODE] Problem with bodies and gravity

Nuno Maltez nunomaltez at gmail.com
Sat Jun 10 09:13:06 MST 2006


I've noticed what seems like a bug in the way bodies are affected by
gravity in ODE 0.6. Consider the following simulation (pseudo-code):

dWorldCreate(); //gravity is (0,0,0)
b1 = dBodyCreate(); dMassSetSphere(); dBodySetMass();
dWorldSetGravity(0.0, -10.0, 0.0);
  dWorldStep(); //b1 starts falling accelerated by gravity
dWorldSetGravity(0.0, 0.0, 0.0);
b2 = dBodyCreate(); dMassSetSphere(); dBodySetMass();
  dWorldStep(); //b1 continues to fall at constant speed, b2 stands still
dWorldSetGravity(0.0, 10.0, 0.0);
  dWorldStep(); //b1 slows downs and eventually inverts its movement,
                         BUT b2 stands still as if unaffected by Gravity

However, dBodyGetGravityMode() returns 1 for both b1 and b2.

It doesn't happen when I create a Body in a World with a non-zero
gravity (after taking some simulation steps): in this case changing
the World's gravity really changes the force applied to the Body. I
can even set the gravity to (0,0,0) and back again to a nonzero value
and all changes seem to be reflected in the force applied to the body.

If you want real code that compiles and run to test this I can provide
it. I just don't know if I should post it to the list or somewhere

Thanks in advance,

More information about the ODE mailing list