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

#include "shared/entity/gravity.hh"

#include "shared/entity/stasis.hh"
#include "shared/entity/velocity.hh"

#include "shared/world/dimension.hh"

#include "shared/globals.hh"

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

    for(auto [entity, velocity] : group.each()) {
        velocity.value.y += fixed_acceleration;
    }
}