summaryrefslogtreecommitdiffstats
path: root/src/game/client/entity/camera.cc
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-12-26 18:09:35 +0500
committeruntodesu <kirill@untode.su>2025-12-26 18:09:35 +0500
commitf755a1eeb45262fe3aea64efc3914709d572afcc (patch)
treebb08dff89a7ddd446a4363edabac8f9ee0514234 /src/game/client/entity/camera.cc
parenteebc2b776717f18e4a24af39b0209afa8eb7404f (diff)
downloadvoxelius-f755a1eeb45262fe3aea64efc3914709d572afcc.tar.bz2
voxelius-f755a1eeb45262fe3aea64efc3914709d572afcc.zip
Add interpolation to Velocity component; fixes #20
- Also disabled snapping to grid for sideways movement as it was somehow messing with player_move code and was making you slide on voxels as if you were on ice (not good)
Diffstat (limited to 'src/game/client/entity/camera.cc')
-rw-r--r--src/game/client/entity/camera.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/game/client/entity/camera.cc b/src/game/client/entity/camera.cc
index 2009066..27603cf 100644
--- a/src/game/client/entity/camera.cc
+++ b/src/game/client/entity/camera.cc
@@ -8,6 +8,7 @@
#include "core/math/angles.hh"
+#include "shared/entity/grounded.hh"
#include "shared/entity/head.hh"
#include "shared/entity/transform.hh"
#include "shared/entity/velocity.hh"
@@ -87,7 +88,7 @@ void camera::update(void)
const auto& head = globals::dimension->entities.get<client::HeadIntr>(globals::player);
const auto& transform = globals::dimension->entities.get<client::TransformIntr>(globals::player);
- const auto& velocity = globals::dimension->entities.get<Velocity>(globals::player);
+ const auto& velocity = globals::dimension->entities.get<client::VelocityIntr>(globals::player);
camera::angles = transform.angles + head.angles;
camera::position_chunk = transform.chunk;
@@ -98,8 +99,7 @@ void camera::update(void)
auto client_angles = camera::angles;
- if(!toggles::get(TOGGLE_PM_FLIGHT)) {
- // Apply the quake-like view rolling
+ if(!toggles::get(TOGGLE_PM_FLIGHT) && globals::dimension->entities.try_get<Grounded>(globals::player)) {
client_angles[2] = math::radians(-camera::roll_angle.get_value() * glm::dot(velocity.value / PMOVE_MAX_SPEED_GROUND, right_vector));
}