From c56b5d6d74a2382cdadba0f33b2ace2b2a762fd2 Mon Sep 17 00:00:00 2001 From: yuni Date: Wed, 22 May 2024 23:50:28 +0200 Subject: [PATCH] dynamic camera movement speed limit based on mouse speed --- src/camera.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/camera.rs b/src/camera.rs index 521020e..aae7401 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -582,7 +582,10 @@ pub fn apply_input_to_player( } } - if pitch_yaw_rot.length_squared() > 1.0e-18 { + let mouse_speed = pitch_yaw_rot.length(); + let mouse_moving = mouse_speed > EPSILON32; + + if mouse_moving { play_reactionwheel_sound = true; pitch_yaw_rot *= settings.mouse_sensitivity * sensitivity_factor * engine.reaction_wheels; @@ -595,7 +598,7 @@ pub fn apply_input_to_player( if settings.rotation_stabilizer_active || key_input.pressed(settings.key_stop) { commands .entity(player_entity) - .insert(actor::WantsMaxRotation(0.0)); + .insert(actor::WantsMaxRotation(mouse_speed as f64 * 0.1)); } else { commands .entity(player_entity)