Commit 6ad48533 authored by Florian Oetke's avatar Florian Oetke
Browse files

fixed clang compilation error

parent b544ba3c
Pipeline #3240 passed with stage
in 2 minutes and 1 second
......@@ -4,6 +4,8 @@
namespace phase_shifter::gameplay {
using mirrage::ecs::components::Transform_comp;
Camera_system::Camera_system(mirrage::ecs::Entity_manager& entity_manager)
: _entity_manager(entity_manager)
{
......@@ -13,8 +15,8 @@ namespace phase_shifter::gameplay {
void Camera_system::update(mirrage::util::Time dt)
{
for(auto&& [camera, viewtarget, spring] :
_entity_manager.list<mirrage::ecs::Entity_facet, Viewtarget_comp, Spring_comp>()) {
for(auto&& [transform, viewtarget, spring] :
_entity_manager.list<Transform_comp, Viewtarget_comp, Spring_comp>()) {
auto target_facet = _entity_manager.get(viewtarget.target);
if(target_facet.is_some()) {
......@@ -30,13 +32,11 @@ namespace phase_shifter::gameplay {
float damping_constant = 2 * sqrtf(spring.spring_constant);
glm::vec3 damping_force = -damping_constant * spring.velocity;
camera.process([&](mirrage::ecs::components::Transform_comp& transform) {
glm::vec3 spring_force = spring.spring_constant * (dest_pos - transform.position);
glm::vec3 acceleration = (spring_force + damping_force) / spring.mass;
spring.velocity += dt.value() * acceleration;
transform.position += dt.value() * spring.velocity;
transform.direction(-offset);
});
glm::vec3 spring_force = spring.spring_constant * (dest_pos - transform.position);
glm::vec3 acceleration = (spring_force + damping_force) / spring.mass;
spring.velocity += dt.value() * acceleration;
transform.position += dt.value() * spring.velocity;
transform.direction(-offset);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment