diff options
author | chai <chaifix@163.com> | 2021-12-02 11:41:42 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-12-02 11:41:42 +0800 |
commit | 7a798253441a8bd499d36bd8153b92ab08de8a9f (patch) | |
tree | 32e4ee995534a4a8cd7c2e0b530ff02c45217e8f /Client/Source/Phy2DLite/World.cpp | |
parent | bcc11176480f403ab294de24d61bab993ce2fdfd (diff) |
*fixed
Diffstat (limited to 'Client/Source/Phy2DLite/World.cpp')
-rw-r--r-- | Client/Source/Phy2DLite/World.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Client/Source/Phy2DLite/World.cpp b/Client/Source/Phy2DLite/World.cpp index 4f48b69..8852f1f 100644 --- a/Client/Source/Phy2DLite/World.cpp +++ b/Client/Source/Phy2DLite/World.cpp @@ -2,10 +2,10 @@ #include "Body.h"
#include "Joint.h"
#include "Arbiter.h"
+#include "Constants.h"
using namespace Phy2D;
- using std::vector; using std::map; using std::pair; @@ -45,7 +45,7 @@ void World::BroadPhase() { Body* bj = bodies[j]; - if (bi->invMass == 0.0f && bj->invMass == 0.0f) + if (bi->invMass == _0 && bj->invMass == _0) continue; Arbiter newArb(bi, bj); @@ -73,7 +73,7 @@ void World::BroadPhase() void World::Step(number dt) { - number inv_dt = dt > 0.0f ? (number)1.0f / dt : (number)0.0f; + number inv_dt = dt > _0 ? _1 / dt : _0; // Determine overlapping bodies and update contact points. BroadPhase(); @@ -83,7 +83,7 @@ void World::Step(number dt) { Body* b = bodies[i]; - if (b->invMass == 0.0f) + if (b->invMass == _0) continue; b->velocity += dt * (gravity + b->invMass * b->force); @@ -123,7 +123,7 @@ void World::Step(number dt) b->position += dt * b->velocity; b->rotation += dt * b->angularVelocity; - b->force.Set(0.0f, 0.0f); - b->torque = 0.0f; + b->force.Set(_0, _0); + b->torque = _0; } }
|