Fixing movements

This commit is contained in:
Zoe Roux
2021-05-31 11:20:31 +02:00
165 changed files with 5426 additions and 1121 deletions
+4 -5
View File
@@ -5,12 +5,11 @@
#include "Component/Position/PositionComponent.hpp"
#include "MovableSystem.hpp"
#include "Component/Movable/MovableComponent.hpp"
#include "Wal.hpp"
namespace BBM
{
MovableSystem::MovableSystem()
: System({
: WAL::System({
typeid(MovableComponent),
typeid(PositionComponent)
})
@@ -21,8 +20,8 @@ namespace BBM
auto &movable = entity.getComponent<MovableComponent>();
auto &position = entity.getComponent<PositionComponent>();
position.position += movable._velocity * WAL::Wal::timestep.count();
movable._velocity = movable._acceleration * WAL::Wal::timestep.count();
position.position += movable._velocity;
movable._velocity = movable._acceleration;
movable._acceleration = Vector3f();
}
}
} // namespace WAL
+2 -1
View File
@@ -6,6 +6,7 @@
#pragma once
#include "System/System.hpp"
#include "Entity/Entity.hpp"
namespace BBM
{
@@ -25,4 +26,4 @@ namespace BBM
//! @brief A movable system is assignable.
MovableSystem &operator=(const MovableSystem &) = default;
};
}
} // namespace WAL