From 9dc6be78f64268961343290964327d494a67ab43 Mon Sep 17 00:00:00 2001 From: liabru Date: Sun, 7 Aug 2022 00:11:16 +0100 Subject: [PATCH] improve delta factors in resolver and constraint stiffness --- src/collision/Resolver.js | 4 ++-- src/constraint/Constraint.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/collision/Resolver.js b/src/collision/Resolver.js index 7ea51ad1..c643ebfc 100644 --- a/src/collision/Resolver.js +++ b/src/collision/Resolver.js @@ -230,9 +230,9 @@ var Bounds = require('../geometry/Bounds'); timeScaleSquared = timeScale * timeScale, timeScaleCubed = timeScaleSquared * timeScale, restingThresh = -Resolver._restingThresh * timeScale, - restingThreshTangent = Resolver._restingThreshTangent * timeScale, + restingThreshTangent = Resolver._restingThreshTangent, frictionNormalMultiplier = Resolver._frictionNormalMultiplier * timeScale, - frictionMaxStatic = Resolver._frictionMaxStatic * timeScale, + frictionMaxStatic = Resolver._frictionMaxStatic, pairsLength = pairs.length, tangentImpulse, maxFriction, diff --git a/src/constraint/Constraint.js b/src/constraint/Constraint.js index eda3ee4f..e6e6948e 100644 --- a/src/constraint/Constraint.js +++ b/src/constraint/Constraint.js @@ -188,7 +188,7 @@ var Common = require('../core/Common'); isRigid = constraint.stiffness >= 1 || constraint.length === 0, stiffness = isRigid ? constraint.stiffness * timeScale : constraint.stiffness * timeScale * timeScale, - damping = constraint.damping * timeScale * timeScale, + damping = constraint.damping * timeScale, force = Vector.mult(delta, difference * stiffness), massTotal = (bodyA ? bodyA.inverseMass : 0) + (bodyB ? bodyB.inverseMass : 0), inertiaTotal = (bodyA ? bodyA.inverseInertia : 0) + (bodyB ? bodyB.inverseInertia : 0),