0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-27 09:50:52 -05:00

improve delta factors in resolver and constraint stiffness

This commit is contained in:
liabru 2022-08-07 00:11:16 +01:00
parent c6a1a6d54d
commit 9dc6be78f6
2 changed files with 3 additions and 3 deletions

View file

@ -230,9 +230,9 @@ 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,
restingThreshTangent = Resolver._restingThreshTangent * timeScale, restingThreshTangent = Resolver._restingThreshTangent,
frictionNormalMultiplier = Resolver._frictionNormalMultiplier * timeScale, frictionNormalMultiplier = Resolver._frictionNormalMultiplier * timeScale,
frictionMaxStatic = Resolver._frictionMaxStatic * timeScale, frictionMaxStatic = Resolver._frictionMaxStatic,
pairsLength = pairs.length, pairsLength = pairs.length,
tangentImpulse, tangentImpulse,
maxFriction, maxFriction,

View file

@ -188,7 +188,7 @@ var Common = require('../core/Common');
isRigid = constraint.stiffness >= 1 || constraint.length === 0, isRigid = constraint.stiffness >= 1 || constraint.length === 0,
stiffness = isRigid ? constraint.stiffness * timeScale stiffness = isRigid ? constraint.stiffness * timeScale
: constraint.stiffness * timeScale * timeScale, : constraint.stiffness * timeScale * timeScale,
damping = constraint.damping * timeScale * timeScale, damping = constraint.damping * timeScale,
force = Vector.mult(delta, difference * stiffness), force = Vector.mult(delta, difference * stiffness),
massTotal = (bodyA ? bodyA.inverseMass : 0) + (bodyB ? bodyB.inverseMass : 0), massTotal = (bodyA ? bodyA.inverseMass : 0) + (bodyB ? bodyB.inverseMass : 0),
inertiaTotal = (bodyA ? bodyA.inverseInertia : 0) + (bodyB ? bodyB.inverseInertia : 0), inertiaTotal = (bodyA ? bodyA.inverseInertia : 0) + (bodyB ? bodyB.inverseInertia : 0),