From f80a24d1913b6ad1e4e51953be2ef832c44828a8 Mon Sep 17 00:00:00 2001 From: xfy Date: Mon, 13 Jul 2026 17:38:02 +0800 Subject: [PATCH] fix: invert orbit camera yaw/pitch to view-follows-cursor direction --- src/camera.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/camera.rs b/src/camera.rs index 0f1b863..132a8ad 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -68,9 +68,11 @@ pub fn orbit_controller( } if mouse.pressed(MouseButton::Left) { for ev in motion.read() { - camera.yaw -= ev.delta.x * 0.005; + // View-follows-cursor: dragging right rotates the view right, + // dragging down tilts it down (inverts the old grab-the-scene mapping). + camera.yaw += ev.delta.x * 0.005; // Clamp pitch to avoid flipping. - camera.pitch = (camera.pitch + ev.delta.y * 0.005).clamp(0.05, std::f32::consts::PI - 0.05); + camera.pitch = (camera.pitch - ev.delta.y * 0.005).clamp(0.05, std::f32::consts::PI - 0.05); } } for ev in wheel.read() {