[ODE] Rewinding time / backward time stepping

Gary R. Van Sickle g.r.vansickle at worldnet.att.net
Tue Sep 3 18:36:01 2002


> I am trying to greatly simplify the mesh on mesh collision problem by
> being able to
> move backward in time. The process will only ever be to have a
> particular point, to move
> forward from it and then possibly discard that forward motion and
> return to the original
> setting. I am wondering about the best way to achieve this.
>

The best way to do this is undoubtedly by saving the previous state.

> This is the full definition of dWorldStep from the docs :
>
> "void dWorldStep(dWorldID, dReal stepsize);
>
> 	Step the world."
>
> So, am I allowed negative step sizes?

I have to admit I'd never thought of that.  I'm certain that won't work; rather,
let me say that I'd be stunned if it did work.  However, it's an interesting
idea: if it could somehow be made to work, you'd save all that previous-state
memory.

[snip]

> Is there already a means for backing up a state, then restoring it?

No.

> If there is not, is there a way of polling for every body in a world,
> allowing me to write
> entire world state backup and restore functions as a black box?
>

No, because it's exactly the stuff in the "black box" that you need to maintain.
I'd be nice if there were perhaps this sort of API:

ODE_STATE_HANDLE dWorldCreateState(dWorldID);
void dWorldStep (dWorldID, dReal stepsize, ODE_STATE_HANDLE last_state,
ODE_STATE_HANDLE new_state);

and then what you could do is create two states, and then just flip between them
each timestep, so there is no copying required:

s1 = dWorldCreateState(w);
s2 = dWorldCreateState(w);
...
if(IsOddFrame)
{
	dWorldStep(w,h, s1, s2);
}
else
{
	dWorldStep(w,h, s2, s1);
}
...

That way there'd be no overhead at all; if you didn't want or need the previous
state, you'd only have one dWorldCreateState().

--
Gary R. Van Sickle
Brewer.  Patriot.