From 6a82c185f2ca8c752a2d91d7494b96726872460b Mon Sep 17 00:00:00 2001 From: yuni Date: Sun, 17 Nov 2024 01:14:13 +0100 Subject: [PATCH] WIP crisper camera controls (fix mouse sensitivity while zooming) --- src/camera.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/camera.rs b/src/camera.rs index 7a1b003..0c2f49f 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -481,12 +481,17 @@ pub fn apply_input_to_player( } if mouse_delta != Vec2::ZERO { if key_input.pressed(settings.key_rotate) { - pitch_yaw_rot[2] += 2.0 * mouse_delta.x / win_res_x; + pitch_yaw_rot[2] += mouse_delta.x / win_res_x; } else { - pitch_yaw_rot[0] += 2.0 * mouse_delta.y / win_res_y; - pitch_yaw_rot[1] -= 2.0 * mouse_delta.x / win_res_x; + pitch_yaw_rot[0] += mouse_delta.y / win_res_y; + pitch_yaw_rot[1] -= mouse_delta.x / win_res_x; } } + pitch_yaw_rot *= 2.0 * if settings.is_zooming { + settings.zoom_sensitivity_factor + } else { + 1.0 + }; // Apply rotation to player if pitch_yaw_rot != Vec3::ZERO {