From f646f70c374401983ec5ef543906629b75f9c77d Mon Sep 17 00:00:00 2001 From: Sara Date: Sat, 30 Aug 2025 13:02:41 +0200 Subject: [PATCH] fix: separated run and weapon bob amplitude --- modules/wave_survival/player_camera.cpp | 6 +++--- modules/wave_survival/player_camera.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/wave_survival/player_camera.cpp b/modules/wave_survival/player_camera.cpp index df8448ee..bd97b5b3 100644 --- a/modules/wave_survival/player_camera.cpp +++ b/modules/wave_survival/player_camera.cpp @@ -40,19 +40,19 @@ void PlayerCamera::update_offset() { this->run_bob_time = 0.0; } double wave{ Math::sin(this->run_bob_time) }; - Vector3 offset{ Vector3{ float(wave), float(Math::abs(wave)), 0 } * this->run_bob_amplitude }; + Vector3 offset{ Vector3{ float(wave), float(Math::abs(wave)), 0 } }; if (!is_running) { this->run_bob_time = MIN(this->run_bob_time, this->run_bob_blend_out); offset = offset.lerp(Vector3(), this->run_bob_time / this->run_bob_blend_out); } GETSET(position, { Basis const basis{ get_basis() }; - position = this->home + basis.get_column(0) * offset.x + basis.get_column(1) * offset.y * 5.0; + position = this->home + (basis.get_column(0) * offset.x + basis.get_column(1) * offset.y) * this->run_bob_amplitude_camera; }); for (Variant child : get_children()) { Node3D *child_3d{ cast_to(child) }; GETSETM(child_3d, position, { - position = offset; + position = offset * this->run_bob_amplitude_weapon; }); } } diff --git a/modules/wave_survival/player_camera.h b/modules/wave_survival/player_camera.h index e2e5130e..7b55a695 100644 --- a/modules/wave_survival/player_camera.h +++ b/modules/wave_survival/player_camera.h @@ -30,7 +30,8 @@ private: PlayerBody *body{ nullptr }; bool was_running{ false }; double run_bob_time{ 0.0 }; - double run_bob_amplitude{ 0.025 }; + double run_bob_amplitude_weapon{ 0.025 }; + double run_bob_amplitude_camera{ 0.125 }; double run_bob_frequency{ 14.0 }; double run_bob_blend_out{ 0.2 }; double weapon_lead_limit{ Math::PI * 0.0075 };