From 69ae279f7634a04b3e8bfa456c7764397d200e05 Mon Sep 17 00:00:00 2001 From: copygirl Date: Mon, 20 Oct 2025 21:16:09 +0200 Subject: [PATCH] Rename CameraFreeLook variable to `look` --- src/free_camera.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/free_camera.rs b/src/free_camera.rs index 23f0249..589ad8f 100644 --- a/src/free_camera.rs +++ b/src/free_camera.rs @@ -40,7 +40,7 @@ pub fn camera_free_look( camera: Single<(&mut Transform, &mut CameraFreeLook)>, ) { let (window, mut cursor) = window.into_inner(); - let (mut transform, mut camera) = camera.into_inner(); + let (mut transform, mut look) = camera.into_inner(); if !window.focused || key_input.just_pressed(KeyCode::Escape) { cursor.grab_mode = CursorGrabMode::None; @@ -54,19 +54,19 @@ pub fn camera_free_look( if cursor.grab_mode == CursorGrabMode::Locked { // Ensure the yaw and pitch are initialized once // from the camera transform's current rotation. - if !camera.initialized { - (camera.yaw, camera.pitch, _) = transform.rotation.to_euler(EulerRot::YXZ); - camera.initialized = true; + if !look.initialized { + (look.yaw, look.pitch, _) = transform.rotation.to_euler(EulerRot::YXZ); + look.initialized = true; } // Update the current camera state's internal yaw and pitch. - let motion = accumulated_mouse_motion.delta * camera.sensitivity; - let (min, max) = camera.pitch_limit.clone().into_inner(); - camera.yaw = (camera.yaw - motion.x).rem_euclid(TAU); // keep within 0°..360° - camera.pitch = (camera.pitch - motion.y).clamp(min, max); + let motion = accumulated_mouse_motion.delta * look.sensitivity; + let (min, max) = look.pitch_limit.clone().into_inner(); + look.yaw = (look.yaw - motion.x).rem_euclid(TAU); // keep within 0°..360° + look.pitch = (look.pitch - motion.y).clamp(min, max); // Override the camera transform's rotation. - transform.rotation = Quat::from_euler(EulerRot::ZYX, 0.0, camera.yaw, camera.pitch); + transform.rotation = Quat::from_euler(EulerRot::ZYX, 0.0, look.yaw, look.pitch); } }