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/World.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Client/Source/Phy2DLite/World.cpp') 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; } } -- cgit v1.1-26-g67d0