face away from the sun

This commit is contained in:
yuni 2024-03-18 03:13:44 +01:00
parent a7ec9ae5a1
commit f4dc03516b

View file

@ -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);
}