[ODE] ODE - Constant speed in different qualities boxes

Michael Lacher michael.lacher at hlw.co.at
Wed Mar 17 11:27:23 MST 2004


Megan Fox wrote:
> #define ODE_STEP_SIZE 0.01
> 
> timeAccumulator += deltaTime; // deltaTime is the time between the previous frame and this one
> 
> while (timeAccumulator > ODE_STEP_SIZE)
> {
>   StepFast(ODE_STEP_SIZE);
>   timeAccumulator -= ODE_STEP_SIZE;
> }
> 
> 
> ^^^ I thought this is the way everyone did it?  You don't want large step sizes, and you can't guarantee the length of time between frames.
> 

I have a quastion about this method:
Do you repeat collision detection for multiple updates ?

ie:

--- BEGIN CODE ---
collideWorld();
while (timeAccumulator > ODE_STEP_SIZE)
{
   StepFast(ODE_STEP_SIZE);
   timeAccumulator -= ODE_STEP_SIZE;
}
updateWorldPositions();
renderWorld();
--- END CODE ---

versus

--- BEGIN CODE ---
while (timeAccumulator > ODE_STEP_SIZE)
{
   collideWorld();
   StepFast(ODE_STEP_SIZE);
   updateWorldPositions();

   timeAccumulator -= ODE_STEP_SIZE;
}
renderWorld();
--- END CODE ---

mucki



More information about the ODE mailing list