1 #include "PhysicsEntity.h"
2 #include "../Vector2.h"
4 /// ***** Public Class Methods *****
5 PhysicsEntity::PhysicsEntity(const Vector2& pos)
10 PhysicsEntity::~PhysicsEntity()
15 void PhysicsEntity::update(float time_step)
17 position = positionAt(time_step);
18 velocity = velocityAt(time_step);
23 Vector2 PhysicsEntity::positionAt(float time_step) const
25 return force/mass / 2 * time_step * time_step + velocity * time_step + position;
28 Vector2 PhysicsEntity::velocityAt(float time_step) const
30 return force/mass / 2 * time_step + velocity;
33 void PhysicsEntity::applyForce(const Vector2& force)
38 void PhysicsEntity::applyImpulse(const Vector2& impluse)