summaryrefslogtreecommitdiffstats
path: root/game/shared/entity/velocity.cc
blob: 9e406886b6210c17ee23dbaf284030b2b9165125 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "shared/pch.hh"

#include "shared/entity/velocity.hh"

#include "shared/entity/stasis.hh"
#include "shared/entity/transform.hh"
#include "shared/world/dimension.hh"

#include "shared/globals.hh"

void entity::Velocity::fixed_update(world::Dimension* dimension)
{
    auto group = dimension->entities.group<entity::Velocity>(entt::get<entity::Transform>, entt::exclude<entity::Stasis>);

    for(auto [entity, velocity, transform] : group.each()) {
        transform.local += velocity.value * globals::fixed_frametime;
    }
}