0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-23 09:26:51 -05:00

changed friction impulse limiting approach

This commit is contained in:
liabru 2015-05-08 00:14:24 +01:00
parent d55c7003e9
commit de4784c492

View file

@ -279,10 +279,10 @@ var Resolver = {};
// modify impulses accounting for mass, inertia and offset
var oAcN = Vector.cross(offsetA, normal),
oBcN = Vector.cross(offsetB, normal),
share = contactShare / (bodyA.inverseMass + bodyB.inverseMass + bodyA.inverseInertia * oAcN * oAcN + bodyB.inverseInertia * oBcN * oBcN);
denom = bodyA.inverseMass + bodyB.inverseMass + bodyA.inverseInertia * oAcN * oAcN + bodyB.inverseInertia * oBcN * oBcN;
normalImpulse *= share;
tangentImpulse *= Math.min(share, 1);
normalImpulse *= contactShare / denom;
tangentImpulse *= contactShare / (1 + denom);
// handle high velocity and resting collisions separately
if (normalVelocity < 0 && normalVelocity * normalVelocity > Resolver._restingThresh * timeScaleSquared) {