feat: implemented weapon lead recentering

This commit is contained in:
Sara Gerretsen 2026-07-08 22:17:11 +02:00
parent 365c9dd0ff
commit 4fa6b0afa5
2 changed files with 8 additions and 1 deletions

View file

@ -73,6 +73,12 @@ void PlayerCamera::process(double delta) {
update_offset();
this->fov_factor = 1.0;
update_fov();
this->weapon_lead_rotation = this->weapon_lead_rotation.move_toward(Vector3(), delta * this->weapon_lead_recenter_speed);
for (Variant child : get_children()) {
if (Node3D * child3d{ cast_to<Node3D>(child) }) {
child3d->set_rotation(this->weapon_lead_rotation);
}
}
}
void PlayerCamera::_notification(int what) {

View file

@ -34,8 +34,9 @@ private:
double run_bob_amplitude_camera{ 0.045 };
double run_bob_frequency{ 12.0 };
double run_bob_blend_out{ 0.2 };
double weapon_lead_limit{ Math::PI * 0.012 };
double weapon_lead_limit{ Math::PI * 0.017 };
double weapon_lead_speed{ 0.12 };
double weapon_lead_recenter_speed{ 0.0 };
Vector3 weapon_lead_rotation{ 0, 0, 0 };
};