Normal values for `dt` in `World::step`

The method World::step(&mut self, dt: N) takes a Scalar value as dt, which I take to mean elapsed time. My question is about what kind of scale this value has, and what it’s normal values would be. In my mind, there are three possibilities:

  1. 1.0 is equal to 1 second
  2. 1.0 is the largest step possible
  3. 1.0 is some ‘standard’ step duration, which is documented elsewhere, or common knowledge in the field.

Also, if this is documented somewhere else, and I have missed it, please don’t hesitate to just link me to relevant documentation. Sometimes knowing where to look is better than just knowing the answer.

Thanks for your time.

Here, dt refers to the time step. Thus 1.0 is 1 second as you mentionned. As an example of “normal value”, the examples of nphysics use 0.016 (that is, 16 milliseconds) as it is close to 1/60 representing a famerate of 60Hz. In general values between 0.01 and 0.02 should yield good results.

Note however than the choice of a time-step is not always easy. The smaller the timestep, the more stable the simulation will be since this will reduce the numerical errors generated by the integration of the equation of motion. On the other hand, for your simulation to be real-time, it is necessary to have a time-step at least equal to the time (in the real world) spent between two frames of your game (or animation, or whichever simulation is being ran).

Unfortunately, this is not documented anywhere… nphysis is currently undergoing deep design changes and it will get a proper documentation once those changes land (around March 2018 I guess).

Thanks for the information. I wasn’t aware of the design changes in the works, that makes the lack of documentation make much more sense.