WIP crisper camera controls (fix mouse sensitivity while zooming)

This commit is contained in:
yuni 2024-11-17 01:14:13 +01:00
parent a3f1f4bd73
commit 6a82c185f2

View file

@ -481,12 +481,17 @@ pub fn apply_input_to_player(
} }
if mouse_delta != Vec2::ZERO { if mouse_delta != Vec2::ZERO {
if key_input.pressed(settings.key_rotate) { 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 { } else {
pitch_yaw_rot[0] += 2.0 * mouse_delta.y / win_res_y; pitch_yaw_rot[0] += mouse_delta.y / win_res_y;
pitch_yaw_rot[1] -= 2.0 * mouse_delta.x / win_res_x; 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 // Apply rotation to player
if pitch_yaw_rot != Vec3::ZERO { if pitch_yaw_rot != Vec3::ZERO {