diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-05-17 10:36:59 +0100 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-05-17 10:36:59 +0100 |
commit | 7583ad924479b11bbd45122194b53a7b6c8f7a0e (patch) | |
tree | f454120b7bd2f5cc344eb221f975321842980a13 /include/YAGE/Physics/body.hpp | |
parent | f7fc06b5066018451b6b456be0dbc46bafe2fd88 (diff) | |
download | YAGE-7583ad924479b11bbd45122194b53a7b6c8f7a0e.tar.gz YAGE-7583ad924479b11bbd45122194b53a7b6c8f7a0e.zip |
Adding files
Diffstat (limited to 'include/YAGE/Physics/body.hpp')
-rw-r--r-- | include/YAGE/Physics/body.hpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/include/YAGE/Physics/body.hpp b/include/YAGE/Physics/body.hpp index 170ef491..c781e1d4 100644 --- a/include/YAGE/Physics/body.hpp +++ b/include/YAGE/Physics/body.hpp @@ -1,5 +1,5 @@ -#ifndef YAGE_BODDY_HPP -#define YAGE_BODDY_HPP +#ifndef YAGE_BODY_HPP +#define YAGE_BODY_HPP #include <glm/glm.hpp> @@ -11,6 +11,10 @@ class Body 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_; @@ -24,16 +28,17 @@ protected: bool gravity_; public: - virtual ~Body() {} + virtual ~Body(); // apply force to the object and update the velocity virtual void applyForce(const glm::vec2 &force)=0; + virtual void update()=0; + + float xPosition() const; + float yPosition() const; protected: // protected constructor to initialize member variables - Body(const glm::vec2 ¢er_of_mass, double mass, const glm::vec2 &force, const glm::vec2 &velocity, bool gravity) : - force_(force), velocity_(velocity), center_of_mass_(center_of_mass), - mass_(mass), gravity_(gravity) - {} + Body(const glm::vec2 ¢er_of_mass, double mass, const glm::vec2 &force, const glm::vec2 &velocity, bool gravity); }; } // yage |