blob: 6a5145f1c5be87b5ce54404d0fb4739aa7478246 (
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 Gravity::fixed_update(Dimension* dimension)
{
auto fixed_acceleration = globals::fixed_frametime * dimension->get_gravity();
auto group = dimension->entities.group<Gravity>(entt::get<Velocity>, entt::exclude<Stasis>);
for(auto [entity, velocity] : group.each()) {
velocity.value.y += fixed_acceleration;
}
}
|