slembcke/Chipmunk2D

Total impulse of cpDampedRotarySpring is wrong, it adds the damping instead of subtracting it.

viblo opened this issue · 0 comments

In the DampedRotarySpring the total impulse is collected in jAcc.
The logic is:

  1. In preStep: impulse = springTorqueFunc(...)*dt
  2. In applyImpulse: impulse += damping torque

However, in the applyImpulse function the damping torque is subtracted from body a's angular velocity, while the impulse in preStep were added. Therefor I believe it should be impulse -= damping torque instead in applyImpulse.

I will make a PR when Im more confident of this finding.

(I noticed this while trying to implement maxForce for the springs: #245 )