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

refactor resolver friction multiplier

This commit is contained in:
liabru 2022-01-03 21:30:23 +00:00
parent 87af8a1740
commit 7130c4ae80

View file

@ -228,8 +228,8 @@ var Bounds = require('../geometry/Bounds');
timeScaleSquared = timeScale * timeScale, timeScaleSquared = timeScale * timeScale,
timeScaleCubed = timeScaleSquared * timeScale, timeScaleCubed = timeScaleSquared * timeScale,
restingThresh = -Resolver._restingThresh * timeScale, restingThresh = -Resolver._restingThresh * timeScale,
frictionNormalMultiplier = Resolver._frictionNormalMultiplier,
restingThreshTangent = Resolver._restingThreshTangent * timeScale, restingThreshTangent = Resolver._restingThreshTangent * timeScale,
frictionNormalMultiplier = Resolver._frictionNormalMultiplier * timeScale,
frictionMaxStatic = Resolver._frictionMaxStatic * timeScale, frictionMaxStatic = Resolver._frictionMaxStatic * timeScale,
pairsLength = pairs.length, pairsLength = pairs.length,
tangentImpulse, tangentImpulse,
@ -256,7 +256,7 @@ var Bounds = require('../geometry/Bounds');
contactsLength = contacts.length, contactsLength = contacts.length,
contactShare = 1 / contactsLength, contactShare = 1 / contactsLength,
inverseMassTotal = bodyA.inverseMass + bodyB.inverseMass, inverseMassTotal = bodyA.inverseMass + bodyB.inverseMass,
friction = pair.friction * pair.frictionStatic * frictionNormalMultiplier * timeScale; friction = pair.friction * pair.frictionStatic * frictionNormalMultiplier;
// update body velocities // update body velocities
bodyAVelocity.x = bodyA.position.x - bodyA.positionPrev.x; bodyAVelocity.x = bodyA.position.x - bodyA.positionPrev.x;