Currently, when calling “step” function on the mechanical_world it not only relies on fixed update period but also talks to the system to get the current Instant (though I am not sure if and how Counters are related to the simulation).
Imagine now the following situation where I’ve got a game where my simulation step is 1/60s but my frame rate varies between 30fps and 60fps (e.g. on slower PC). That would cause that the time in my game will diverge form the real one causing lags and other unpredictable results.
In order to simplify the interface I would suggest that the “step” function should accept two more arguments:
- currentTimestamp (ms/µs) - absolute timestamp for logging and debugging
- deltaTimestamp (ms/µs) - time passed since last step call.
It should be users’ responsibility to compute the delta and make it as small as possible. Therefore no references to absolute time from within the engine would be needed.
BTW I know I can modify “dt” param before each step call, yet it is not what I expect.
I would be happy to provide a PR if that sounds reasonable.