schteppe / p2.js

JavaScript 2D physics library
Other
2.64k stars 330 forks source link

RotationalSpring damping is ignored #358

Open simonbw opened 4 years ago

simonbw commented 4 years ago

The damping property on RotationalSpring doesn't seem to have any effect. I believe that is due to this line where the damping torque is multiplied by 0.

RotationalSpring.prototype.applyForce = function(){
    // ... d = damping
    var torque = - k * (x - l) - d * u * 0;
    // ...
};

It looks like this was added intentionally at some point, but I'm not quite sure why, so I figured I'd create an issue to bring it up. Removing the * 0 seemed to make this function nicely for me.