mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-23 09:26:51 -05:00
optimised Resolver.solveVelocity
This commit is contained in:
parent
e4b3bcd69e
commit
30b899c862
1 changed files with 2 additions and 2 deletions
|
@ -290,7 +290,7 @@ var Bounds = require('../geometry/Bounds');
|
|||
|
||||
// coulomb friction
|
||||
var normalOverlap = pair.separation + normalVelocity;
|
||||
var normalForce = normalOverlap > 1 ? 1 : normalOverlap;
|
||||
var normalForce = Math.min(normalOverlap, 1);
|
||||
normalForce = normalOverlap < 0 ? 0 : normalForce;
|
||||
|
||||
var frictionLimit = normalForce * friction;
|
||||
|
@ -327,7 +327,7 @@ var Bounds = require('../geometry/Bounds');
|
|||
// impulse constraint tends to 0
|
||||
var contactNormalImpulse = contact.normalImpulse;
|
||||
contact.normalImpulse += normalImpulse;
|
||||
contact.normalImpulse = contact.normalImpulse < 0 ? contact.normalImpulse : 0;
|
||||
contact.normalImpulse = Math.min(contact.normalImpulse, 0);
|
||||
normalImpulse = contact.normalImpulse - contactNormalImpulse;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue