0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-12-26 13:49:01 -05:00

fix constraint.angularStiffness

This commit is contained in:
liabru 2017-05-03 22:05:38 +01:00
parent 1bae2dee45
commit ab0283b5b3

View file

@ -191,7 +191,7 @@ var Common = require('../core/Common');
bodyA.position.y -= force.y * share; bodyA.position.y -= force.y * share;
// apply torque // 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.constraintImpulse.angle -= torque;
bodyA.angle -= torque; bodyA.angle -= torque;
} }
@ -208,7 +208,7 @@ var Common = require('../core/Common');
bodyB.position.y += force.y * share; bodyB.position.y += force.y * share;
// apply torque // 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.constraintImpulse.angle += torque;
bodyB.angle += torque; bodyB.angle += torque;
} }