From 7a798253441a8bd499d36bd8153b92ab08de8a9f Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 2 Dec 2021 11:41:42 +0800 Subject: *fixed --- Client/Source/Phy2DLite/Joint.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'Client/Source/Phy2DLite/Joint.cpp') diff --git a/Client/Source/Phy2DLite/Joint.cpp b/Client/Source/Phy2DLite/Joint.cpp index 95f7c64..71375d0 100644 --- a/Client/Source/Phy2DLite/Joint.cpp +++ b/Client/Source/Phy2DLite/Joint.cpp @@ -1,6 +1,7 @@ #include "Joint.h" #include "Body.h" #include "World.h" +#include "Constants.h" using namespace Phy2D; @@ -17,10 +18,10 @@ void Joint::Set(Body* b1, Body* b2, const Vec2& anchor) localAnchor1 = Rot1T * (anchor - body1->position); localAnchor2 = Rot2T * (anchor - body2->position); - P.Set(0.0f, 0.0f); + P.Set(_0, _0); - softness = 0.0f; - biasFactor = 0.2f; + softness = _0; + biasFactor = _0_2; } void Joint::PreStep(number inv_dt) @@ -37,8 +38,8 @@ void Joint::PreStep(number inv_dt) // = [1/m1+1/m2 0 ] + invI1 * [r1.y*r1.y -r1.x*r1.y] + invI2 * [r1.y*r1.y -r1.x*r1.y] // [ 0 1/m1+1/m2] [-r1.x*r1.y r1.x*r1.x] [-r1.x*r1.y r1.x*r1.x] Mat22 K1; - K1.col1.x = body1->invMass + body2->invMass; K1.col2.x = 0.0f; - K1.col1.y = 0.0f; K1.col2.y = body1->invMass + body2->invMass; + K1.col1.x = body1->invMass + body2->invMass; K1.col2.x = _0; + K1.col1.y = _0; K1.col2.y = body1->invMass + body2->invMass; Mat22 K2; K2.col1.x = body1->invI * r1.y * r1.y; K2.col2.x = -body1->invI * r1.x * r1.y; @@ -64,7 +65,7 @@ void Joint::PreStep(number inv_dt) } else { - bias.Set(0.0f, 0.0f); + bias.Set(_0, _0); } if (World::warmStarting) @@ -78,7 +79,7 @@ void Joint::PreStep(number inv_dt) } else { - P.Set(0.0f, 0.0f); + P.Set(_0, _0); } } -- cgit v1.1-26-g67d0