2016-03-08 18:49:28 +00:00
|
|
|
#include "physics_object.hpp"
|
|
|
|
|
2016-03-08 20:16:02 +00:00
|
|
|
void PhysicsObject::update(State state) {
|
|
|
|
sf::Vector2f forces = getForces(state);
|
2016-03-08 18:49:28 +00:00
|
|
|
|
|
|
|
// TODO: intégrer le vecteur force dans la vitesse puis la position
|
|
|
|
}
|
|
|
|
|
2016-03-09 18:53:08 +00:00
|
|
|
sf::Vector2f getVelocity() {
|
|
|
|
return velocity;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setVelocity(sf::Vector2f set_velocity) {
|
|
|
|
velocity = set_velocity;
|
|
|
|
}
|
|
|
|
|
|
|
|
int getMass() {
|
|
|
|
return mass;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setMass(int set_mass) {
|
|
|
|
mass = set_mass;
|
|
|
|
}
|
|
|
|
|
2016-03-08 18:49:28 +00:00
|
|
|
sf::Vector2f PhysicsObject::getForces(State state) {
|
|
|
|
sf::Vector2f forces(0, 0);
|
|
|
|
|
|
|
|
// force de gravité
|
2016-03-08 20:16:02 +00:00
|
|
|
forces += sf::Vector2f(0, PhysicsObject::GRAVITY);
|
2016-03-08 18:49:28 +00:00
|
|
|
|
|
|
|
// TODO: collisions entre objets
|
|
|
|
|
|
|
|
return forces;
|
|
|
|
}
|