Parameter | Description |
---|---|
frequency | The frequency of the spring, in cycles per second. |
damping | The damping of the spring. Must be >= zero. |
translation | The current translation of the spring. |
speed | The current speed of the spring. |
deltaTime | The time over which to simulate the spring. |
float The new calculated spring speed.
Calculate a one-dimensional mass-spring-damper simulation which drives towards a zero translation. You can then compute the new position using: "translation += newSpeed * deltaTime;"