mirror of
https://github.com/liabru/matter-js.git
synced 2025-03-08 23:03:36 -05:00
remove constraint torque clamp
This commit is contained in:
parent
2e6afd477a
commit
6f892502c2
1 changed files with 2 additions and 12 deletions
|
@ -206,12 +206,6 @@ var Common = require('../core/Common');
|
||||||
if (bodyA && !bodyA.isStatic) {
|
if (bodyA && !bodyA.isStatic) {
|
||||||
torque = Vector.cross(offsetA, normalVelocity) * bodyA.inverseInertia * (1 - constraint.angularStiffness);
|
torque = Vector.cross(offsetA, normalVelocity) * bodyA.inverseInertia * (1 - constraint.angularStiffness);
|
||||||
|
|
||||||
Sleeping.set(bodyA, false);
|
|
||||||
|
|
||||||
// clamp to prevent instability
|
|
||||||
// TODO: solve this properly
|
|
||||||
torque = Common.clamp(torque, -0.01, 0.01);
|
|
||||||
|
|
||||||
// keep track of applied impulses for post solving
|
// keep track of applied impulses for post solving
|
||||||
bodyA.constraintImpulse.x -= force.x;
|
bodyA.constraintImpulse.x -= force.x;
|
||||||
bodyA.constraintImpulse.y -= force.y;
|
bodyA.constraintImpulse.y -= force.y;
|
||||||
|
@ -226,12 +220,6 @@ var Common = require('../core/Common');
|
||||||
if (bodyB && !bodyB.isStatic) {
|
if (bodyB && !bodyB.isStatic) {
|
||||||
torque = Vector.cross(offsetB, normalVelocity) * bodyB.inverseInertia * (1 - constraint.angularStiffness);
|
torque = Vector.cross(offsetB, normalVelocity) * bodyB.inverseInertia * (1 - constraint.angularStiffness);
|
||||||
|
|
||||||
Sleeping.set(bodyB, false);
|
|
||||||
|
|
||||||
// clamp to prevent instability
|
|
||||||
// TODO: solve this properly
|
|
||||||
torque = Common.clamp(torque, -0.01, 0.01);
|
|
||||||
|
|
||||||
// keep track of applied impulses for post solving
|
// keep track of applied impulses for post solving
|
||||||
bodyB.constraintImpulse.x += force.x;
|
bodyB.constraintImpulse.x += force.x;
|
||||||
bodyB.constraintImpulse.y += force.y;
|
bodyB.constraintImpulse.y += force.y;
|
||||||
|
@ -260,6 +248,8 @@ var Common = require('../core/Common');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Sleeping.set(body, false);
|
||||||
|
|
||||||
// update geometry and reset
|
// update geometry and reset
|
||||||
for (var j = 0; j < body.parts.length; j++) {
|
for (var j = 0; j < body.parts.length; j++) {
|
||||||
var part = body.parts[j];
|
var part = body.parts[j];
|
||||||
|
|
Loading…
Add table
Reference in a new issue