mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-27 09:50:52 -05:00
changed friction impulse limiting approach
This commit is contained in:
parent
d55c7003e9
commit
de4784c492
1 changed files with 3 additions and 3 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue