This project has moved. For the latest updates, please go here.

Step with dt=0

Topics: Developer Forum
Jul 21, 2013 at 12:33 AM
I am building a game in which time can be stopped and rewound. When time is stopped it is possible to place objects and some bodies can still be moved (by just changing position).

I need to check for collision when time is stopped, so I was thinking of stepping the Box2D world 0 time forward, as collision detection and such would still be solved.

I can see from the source code that stepping with a delta time of 0 is ignored.

Is there any other way of doing this sort of thing?

Jul 22, 2013 at 9:13 AM
Edited Jul 22, 2013 at 9:14 AM
Just a though. How about, instead of stopping time, stop all objects?
Just remove, and remember, the velocity of all objects and reassign them when the simulation should continue.
Jul 23, 2013 at 1:00 PM
Farseer is open source, so I would suggest you just remove the if (dt == 0) condition in World.Step()

I have just removed the condition since dt = 0 and Enabled = false had the same behavior - I would rather have people use the Enabled property in that case.
Jul 23, 2013 at 10:00 PM
Good point, I did that :) Nice you made the change, it makes more sense that way. Thanks!