From ab0283b5b39908bd3306625fec6bac6685b6732b Mon Sep 17 00:00:00 2001 From: liabru Date: Wed, 3 May 2017 22:05:38 +0100 Subject: [PATCH] fix constraint.angularStiffness --- src/constraint/Constraint.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/constraint/Constraint.js b/src/constraint/Constraint.js index 07509c7..61ebd13 100644 --- a/src/constraint/Constraint.js +++ b/src/constraint/Constraint.js @@ -191,7 +191,7 @@ var Common = require('../core/Common'); bodyA.position.y -= force.y * share; // apply torque - torque = (Vector.cross(pointA, force) / resistanceTotal) * Constraint._torqueDampen * bodyA.inverseInertia; + torque = (Vector.cross(pointA, force) / resistanceTotal) * Constraint._torqueDampen * bodyA.inverseInertia * (1 - constraint.angularStiffness); bodyA.constraintImpulse.angle -= torque; bodyA.angle -= torque; } @@ -208,7 +208,7 @@ var Common = require('../core/Common'); bodyB.position.y += force.y * share; // apply torque - torque = (Vector.cross(pointB, force) / resistanceTotal) * Constraint._torqueDampen * bodyB.inverseInertia; + torque = (Vector.cross(pointB, force) / resistanceTotal) * Constraint._torqueDampen * bodyB.inverseInertia * (1 - constraint.angularStiffness); bodyB.constraintImpulse.angle += torque; bodyB.angle += torque; }