Skip to content

Commit

Permalink
changed friction impulse limiting approach
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed May 7, 2015
1 parent d55c700 commit de4784c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/collision/Resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit de4784c

Please sign in to comment.