Hi,
I'm implementing the ideas found in [0] and specifically the client side prediction. To do it, I need to be able to rewind the (client-side) simulation and replay it with the (server-issued) correct state.
I'd like to know what part of a rigib body state I need to save (from the server) and set back (on the client) to be able to restart the simulation in the corrected state.
I thought it was the position, momentum, orientation and angular momentum... Could you please give me the name of the btDigidBody's methods I need to read/write the needed state?
Thank you!
[0] http://gafferongames.wordpress.com/2004 ... d-physics/
save and reload rigid body state for client side prediction
-
noteed
- Posts: 2
- Joined: Thu Sep 02, 2010 3:27 pm
-
noteed
- Posts: 2
- Joined: Thu Sep 02, 2010 3:27 pm
Re: save and reload rigid body state for client side predict
I have a second question regarding this issue.
The problem is this, assuming a world with a single rigib body. Here is some pseudo code:
My first question was what are the methods I can use to save and reset the rigid body state so that state0 and state1 are identical (this should be just enough of information such that stepSimulation re-computes the same results)?
My second is this. stepSimulation has its own notion of time. This means that even if I can save and reset the rigid body state, stepSimulation won't compute the exact same thing if, for instance, I pass it a timeStep of 11ms and it runs ith an internal time step of 10ms: internally, it will remain 1ms of backlog. But if I want to be able to repeat exactly the simulation after the reset, the backlog should also be reset. So, how can I do this?
Thanks.
The problem is this, assuming a world with a single rigib body. Here is some pseudo code:
Code: Select all
savedState <- save rigid body state
stepSimulation
state0 <- full rigid body state
reset rigid body state with savedState // this is like performing a rewind on the rigid body
stepSimulation
state1 <- full rigid body state
assert (state0 == state1)
My second is this. stepSimulation has its own notion of time. This means that even if I can save and reset the rigid body state, stepSimulation won't compute the exact same thing if, for instance, I pass it a timeStep of 11ms and it runs ith an internal time step of 10ms: internally, it will remain 1ms of backlog. But if I want to be able to repeat exactly the simulation after the reset, the backlog should also be reset. So, how can I do this?
Thanks.