aboutsummaryrefslogtreecommitdiff
path: root/Client/Source/Phy2DLite/Joint.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-12-02 11:41:42 +0800
committerchai <chaifix@163.com>2021-12-02 11:41:42 +0800
commit7a798253441a8bd499d36bd8153b92ab08de8a9f (patch)
tree32e4ee995534a4a8cd7c2e0b530ff02c45217e8f /Client/Source/Phy2DLite/Joint.cpp
parentbcc11176480f403ab294de24d61bab993ce2fdfd (diff)
*fixed
Diffstat (limited to 'Client/Source/Phy2DLite/Joint.cpp')
-rw-r--r--Client/Source/Phy2DLite/Joint.cpp15
1 files changed, 8 insertions, 7 deletions
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);
}
}