summaryrefslogtreecommitdiffstats
path: root/src/game/shared/gravity.cc
blob: 068f658823da727df760ddbe8da42e3e7aac98f9 (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/gravity.hh"

#include "shared/dimension.hh"
#include "shared/globals.hh"
#include "shared/stasis.hh"
#include "shared/velocity.hh"

void GravityComponent::fixed_update(Dimension* dimension)
{
    auto fixed_acceleration = globals::fixed_frametime * dimension->get_gravity();
    auto group = dimension->entities.group<GravityComponent>(entt::get<VelocityComponent>, entt::exclude<StasisComponent>);

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