[ODE] Problem with Hanging Objects under gravity

Jon Watte (ODE) hplus-ode at mindcontrol.org
Tue Aug 1 08:23:54 MST 2006

achaudhry wrote:
> This model is not succesfull as within a short span of time, due to gravity ,
> the ropes start swinging, and fnally become unstable. 
> Please suggest me on where am i making a mistake. 
> Thanking you, 

You need to introduce velocity and rotational velocity dampening to your 
bodies in each step. Else the force added by gravity may add energy to 
the system. Each step, for each body, do something like (from memory):

dVector3 vel;
dBodyGetLinearVelocity(body, vel);
vel[0] *= -0.01; vel[1] *= -0.01; vel[2] *= 0.01;
dBodyAddForce(body, vel);
dBodyGetAngularVelocity(body, vel);
vel[0] *= -0.03; vel[1] *= -0.03; vel[2] *= -0.03;
dBodyAddTorque(body, vel);

The multiplied numbers will of course need to change based on your 
simulation and time step size.

Also make sure that the boxes don't actually touch in the default 
configuration -- you have to leave a little bit of clearance. For this 
reason, I prefer to use ccylinders (capsules) for ropes.


             / h+

More information about the ODE mailing list