From f4dc03516be586d2f5fa1c1ded79ec0c5b136b67 Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 18 Mar 2024 03:13:44 +0100 Subject: [PATCH] face away from the sun --- src/camera.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/camera.rs b/src/camera.rs index 694a819..2a8dec0 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -57,8 +57,8 @@ impl Default for CameraController { keyboard_key_toggle_cursor_grab: KeyCode::KeyM, move_speed: 1.0, friction: 0.1, - pitch: 0.0, - yaw: 0.0, + pitch: 1.0, // pitch=0/yaw=0 -> face sun + yaw: 0.3, velocity: Vec3::ZERO, } } @@ -113,10 +113,9 @@ fn run_camera_controller( if let Ok((mut transform, mut controller)) = query.get_single_mut() { if !controller.initialized { - let (yaw, pitch, _roll) = transform.rotation.to_euler(EulerRot::YXZ); - controller.yaw = yaw; - controller.pitch = pitch; controller.initialized = true; + transform.rotation = + Quat::from_euler(EulerRot::ZYX, 0.0, controller.yaw, controller.pitch); *toggle_cursor_grab = true; info!("{}", *controller); }