Replies: 1 comment 2 replies
-
I guess it actually was an attempt to make it timestep independent. If you just compute the damping like
the effect will directly depend on the timestep - halving the timestep will make a rigid body slowdown twice faster. But of course, just scaling the damping coefficient with the timestep won't do the trick. The correct formula should be something like:
Then the damping coefficient would mean the percent of velocity a rigid body loses per second. With any timestep. Though, maybe they just didn't want to calculate the exponential function, so used this kind of 'approximation'. |
Beta Was this translation helpful? Give feedback.
-
The only thing that I could find in the documentation was here, which suggests that the damping force is calculated by multiplying the velocity by the coefficient. However, looking at
bodyCoreComputeUnconstrainedVelocity()
in the source code, I can see that damping is applied by taking:dampedVelocity = undampedVelocity * max(0, (1.0 - damping * dt))
This feels odd, since the magnitude of the damping is now affected by the timestep. A smaller timestep results in less damping. This explains the behavior that I've been seeing. Is there a reason why the damping is multiplied by the timestep? It feels more intuitive to treat the damping as a percentage, so that 0 corresponds to no damping and 1 corresponds to setting the velocity to zero each frame.
Beta Was this translation helpful? Give feedback.
All reactions