Do you mean making up for low framerate of slow computers? You can try giving a higher timestep to b2World.Step based on flash.utils.getTimer diffirence. I'm not sure if the engine is meant that way though.
physical calculation - the same on every computer ?!
FlashThe box2d engine will always produce the same results, providing that the time step doesn't change according to the display framerate, as you correctly observed.
Hence you can always get reproducible results by using a fixed time step for your physics, which is independent of the display rate, and just slow down the display framerate for slower computers. Until recently this was the only way of properly handling time issues with Box2d, and I imagine it is still the most prevalent.
Please see Fix Your Timestep! for details on how to implement this.
Hence you can always get reproducible results by using a fixed time step for your physics, which is independent of the display rate, and just slow down the display framerate for slower computers. Until recently this was the only way of properly handling time issues with Box2d, and I imagine it is still the most prevalent.
Please see Fix Your Timestep! for details on how to implement this.
Even with the same time step you can get slightly different results on different CPUs due to floating point differences. Over time these differences get magnified.
The only solution for getting the exact same result is to use fixed-point math.
The only solution for getting the exact same result is to use fixed-point math.
Arg, I hadn't thought about that. I guess it's important to emphasize Box2d is meant more for casual simulation at decent speeds and quantities, rather than absolute accuracy (though it is presumably much better now CCD is in place).
Original thread: https://box2d.org/forum/viewtopic.php?t=407