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/Body.cpp | 45 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'Client/Source/Phy2DLite/Body.cpp') diff --git a/Client/Source/Phy2DLite/Body.cpp b/Client/Source/Phy2DLite/Body.cpp index 1d896fd..993c3f8 100644 --- a/Client/Source/Phy2DLite/Body.cpp +++ b/Client/Source/Phy2DLite/Body.cpp @@ -1,47 +1,48 @@ #include "Body.h" +#include "Constants.h" using namespace Phy2D; Body::Body() { - position.Set(0.0f, 0.0f); - rotation = 0.0f; - velocity.Set(0.0f, 0.0f); - angularVelocity = 0.0f; - force.Set(0.0f, 0.0f); - torque = 0.0f; - friction = 0.2f; + position.Set(_0, _0); + rotation = _0; + velocity.Set(_0, _0); + angularVelocity = _0; + force.Set(_0, _0); + torque = _0; + friction = _0_2; - width.Set(1.0f, 1.0f); + width.Set(_1, _1); mass = NUMBER_MAX; - invMass = 0.0f; + invMass = _0; I = NUMBER_MAX; - invI = 0.0f; + invI = _0; } void Body::Set(const Vec2& w, number m) { - position.Set(0.0f, 0.0f); - rotation = 0.0f; - velocity.Set(0.0f, 0.0f); - angularVelocity = 0.0f; - force.Set(0.0f, 0.0f); - torque = 0.0f; - friction = 0.2f; + position.Set(_0, _0); + rotation = _0; + velocity.Set(_0, _0); + angularVelocity = _0; + force.Set(_0, _0); + torque = _0; + friction = _0_2; width = w; mass = m; if (mass < NUMBER_MAX) { - invMass = (number)1.0f / mass; - I = mass * (width.x * width.x + width.y * width.y) / 12.0f; - invI = (number)1.0f / I; + invMass = (number)_1 / mass; + I = mass * (width.x * width.x + width.y * width.y) / _12; + invI = (number)_1 / I; } else { - invMass = 0.0f; + invMass = _0; I = NUMBER_MAX; - invI = 0.0f; + invI = _0; } } -- cgit v1.1-26-g67d0