[ODE] Leftover step time step instability

Martin C. Martin martin at metahuman.org
Thu Aug 14 16:17:02 2003


"Matthews, Steve USA" wrote:
> 
> 
> Can anyone tell me why trying to step by this leftover time would create instability? 

If the timestep is very small, you may end up with some division by zeros,
or something close.


> And do you know if there are any issues with forgetting about the leftover time, as I have done. (which, as I said, works)

What I do is, essentially, keep those leftovers around, and when they get
big enough, take an extra world step.  Here's some pseudo code:


float time_to_make_up = 0;

...

time_to_make_up += amount of wall clock time that has passed.

int num_steps = (int) (time_to_make_up / SECONDS_PER_STEP);

for (int i = 0; i < num_steps; ++i) {
   world.step(SECONDS_PER_STEP);
}

time_to_make_up -= SECONDS_PER_STEP * num_steps;


- Martin

#################################################################
#################################################################
#################################################################
#####
#####
#####
#################################################################
#################################################################
#################################################################