aboutsummaryrefslogtreecommitdiffstats
path: root/include/YAGE/Physics/body.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/YAGE/Physics/body.hpp')
-rw-r--r--include/YAGE/Physics/body.hpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/include/YAGE/Physics/body.hpp b/include/YAGE/Physics/body.hpp
index c781e1d4..54fdeb3f 100644
--- a/include/YAGE/Physics/body.hpp
+++ b/include/YAGE/Physics/body.hpp
@@ -8,25 +8,28 @@ namespace yage
class Body
{
+public:
+ // gravity constant
+ static const double GRAVITY;
protected:
- // current force acting on object
- glm::vec2 force_;
-
- // current acceleration
- glm::vec2 acceleration_=glm::vec2(0.f, 0.f);
-
- // current velocity of the object
- glm::vec2 velocity_;
-
// center of mass of the object
- glm::vec2 center_of_mass_;
+ glm::vec2 position_=glm::vec2(0.f, 0.f);
// mass of the object
- double mass_;
+ double mass_=1.0;
+
+ // current velocity of the object
+ glm::vec2 velocity_=glm::vec2(0.f, 0.f);
// boolean that defines if gravity can act on the object
- bool gravity_;
-
+ bool gravity_=true;
+
+ // current acceleration
+ glm::vec2 acceleration_=glm::vec2(0.f, 0.f);
+
+ // force acting on the body
+ glm::vec2 force_=glm::vec2(0.f, 0.f);
+
public:
virtual ~Body();
@@ -38,7 +41,10 @@ public:
float yPosition() const;
protected:
// protected constructor to initialize member variables
- Body(const glm::vec2 &center_of_mass, double mass, const glm::vec2 &force, const glm::vec2 &velocity, bool gravity);
+ Body(const glm::vec2 &position=glm::vec2(0.f, 0.f),
+ double mass=1.0,
+ const glm::vec2 &velocity=glm::vec2(0.f, 0.f),
+ bool gravity=false);
};
} // yage