[ODE] Forcing bodies to specified "non-physic-calculated"positions

Jon Watte hplus-ode at mindcontrol.org
Thu Feb 5 09:39:15 MST 2004


> Because frame time isn't absolutely constant the
> calculated forces are too low or too high.

> step by 1ms at a time is too expensive

You don't need to step 1 ms at a time; 10 ms at a time should be fine. The loop should be something like:

last = seconds();
while( running ) {
  now = seconds();
  while( last < now ) {
    saved_state = cur_state;
    saved_time = last;
    step( 0.01 );
    last += 0.01;
  }
  now = seconds();
  render( saved_state, saved_time, cur_state, now ); 
}

This updates the world at a steady rate, and uses interpolation in rendering to get a smooth frame rate, potentially higher than your highest possible physics rate.

Cheers,

			/ h+




More information about the ODE mailing list