Added bool in Physics to toggle gravity for entities.

This commit is contained in:
William Moberg
2016-01-18 18:16:24 +01:00
parent bf3f8aea89
commit b2358a1854
3 changed files with 5 additions and 1 deletions
+3 -1
View File
@@ -9,7 +9,9 @@ void PlayerMovementSystem::UpdateComponent(World* world, EntityWrapper& entity,
ComponentWrapper& cPhysics = entity["Physics"];
glm::vec3& velocity = cPhysics["Velocity"];
velocity.y -= 9.82 * dt;
if (cPhysics["Gravity"]) {
velocity.y -= 9.82 * dt;
}
glm::vec3& position = cTransform["Position"];
position += velocity * (float)dt;