Initial work on PlayerMovementSystem

This commit is contained in:
2016-01-14 17:03:42 +01:00
parent 986af01091
commit 6ad1839def
22 changed files with 146 additions and 30 deletions
+16
View File
@@ -0,0 +1,16 @@
#include "Systems/PlayerMovementSystem.h"
void PlayerMovementSystem::UpdateComponent(World* world, EntityWrapper& entity, ComponentWrapper& component, double dt)
{
ComponentWrapper& cTransform = entity["Transform"];
if (!entity.HasComponent("Physics")) {
return;
}
ComponentWrapper& cPhysics = entity["Physics"];
glm::vec3& velocity = cPhysics["Velocity"];
velocity.y -= 9.82 * dt;
glm::vec3& position = cTransform["Position"];
position += velocity * (float)dt;
}