[ODE] ODE and geom scales

Jon Watte hplus-ode at mindcontrol.org
Fri Dec 17 09:09:08 MST 2004


> I like the idea of the hovering CCylinder, but how does that work with 
> gravity ?

If you apply a force that's proportional to your vertical velcoty 
and distance to ground, then that force will also compensate for 
gravity. I effect, the force is a spring, which gravity will 
compress a little bit, so if you're striving for 0.50 meters of 
distance-to-ground, you may end up running around with an average 
of 0.45.

> If you apply a vertical force up to make the CCylinder hover, gravity 
> will be disabled. Doesn't
> that lead to strange behaviors ?

Gravity will not be disabled. It's important that the force is 
stronger the closer to ground you are (1- or 1/ relationship), and 
it's usually better to also take the existing velocity along Y 
into account.

Something like:

  LookAhead = 0.1f; // 100 ms into the future

  distance = MyRayCastToGround();
  velocity = dot( LinearVelocity, DownVector );
  distanceSoon = distance + LookAhead * velocity;
  if( distanceSoon < 0.01f ) distanceSoon = 0.01f; // clamp really high forces
  upForce = -Gravity * (DesiredHeight / distanceSoon) * BodyMass;

Cheers,

			/ h+




More information about the ODE mailing list