Hello,
I am making an application where I need to record the physics simulations; the simulation consists of applying an impulse to a single body, and let the engine do its job. To do this, I save the position of the body from GetPosition() and the angle from GetAngle(), and when the movie is replayed, I pass this information to SetXForm(). My thinking was that if the original positions are the same of what they were originally, and if I apply the same impulse to the body as before, the simulation should be exactly, or very close to, the original simulation.
When I retrieve the position and angle of the body after one step, I see that current GetPosition() doesn't differ much from the previous value (in term of pixels, the different is less than half a pixel), but the angle is off by little more than 1 degree. This causes the replay to differ siginificantly from the original simulation.
The way that I've thought of for compensating this difference is to continuously adjust the angle of the body until I am close to some reasonable degree to the desired angle. Would this be the way to about this problem? Or is there an easier/different way?
Thanks.
I am making an application where I need to record the physics simulations; the simulation consists of applying an impulse to a single body, and let the engine do its job. To do this, I save the position of the body from GetPosition() and the angle from GetAngle(), and when the movie is replayed, I pass this information to SetXForm(). My thinking was that if the original positions are the same of what they were originally, and if I apply the same impulse to the body as before, the simulation should be exactly, or very close to, the original simulation.
When I retrieve the position and angle of the body after one step, I see that current GetPosition() doesn't differ much from the previous value (in term of pixels, the different is less than half a pixel), but the angle is off by little more than 1 degree. This causes the replay to differ siginificantly from the original simulation.
The way that I've thought of for compensating this difference is to continuously adjust the angle of the body until I am close to some reasonable degree to the desired angle. Would this be the way to about this problem? Or is there an easier/different way?
Thanks.