diff options
author | chai <chaifix@163.com> | 2021-11-30 23:50:01 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-11-30 23:50:01 +0800 |
commit | 84d961f754c905b37420f4d1b3fee8f4e523e58a (patch) | |
tree | aa3669ac285f7186ecd6a26f874da9bba765178b /Client/Source/Phy2DLite/Joint.h | |
parent | 9e0e01b7f4375063f06e494113187d48614628e0 (diff) |
+phy2d lite
Diffstat (limited to 'Client/Source/Phy2DLite/Joint.h')
-rw-r--r-- | Client/Source/Phy2DLite/Joint.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Client/Source/Phy2DLite/Joint.h b/Client/Source/Phy2DLite/Joint.h new file mode 100644 index 0000000..1aafed4 --- /dev/null +++ b/Client/Source/Phy2DLite/Joint.h @@ -0,0 +1,34 @@ +#pragma once + +#include "Math.h" + +namespace Phy2D +{ + + struct Body; + + struct Joint + { + Joint() : + body1(0), body2(0), + P(0.0f, 0.0f), + biasFactor(0.2f), softness(0.0f) + {} + + void Set(Body* body1, Body* body2, const Vec2& anchor); + + void PreStep(number inv_dt); + void ApplyImpulse(); + + Mat22 M; + Vec2 localAnchor1, localAnchor2; + Vec2 r1, r2; + Vec2 bias; + Vec2 P; // accumulated impulse + Body* body1; + Body* body2; + number biasFactor; + number softness; + }; + +} |