aboutsummaryrefslogtreecommitdiff
path: root/Client/Source/Phy2DLite/Body.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Source/Phy2DLite/Body.cpp')
-rw-r--r--Client/Source/Phy2DLite/Body.cpp45
1 files changed, 23 insertions, 22 deletions
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;
}
}