face away from the sun
This commit is contained in:
parent
a7ec9ae5a1
commit
f4dc03516b
|
@ -57,8 +57,8 @@ impl Default for CameraController {
|
||||||
keyboard_key_toggle_cursor_grab: KeyCode::KeyM,
|
keyboard_key_toggle_cursor_grab: KeyCode::KeyM,
|
||||||
move_speed: 1.0,
|
move_speed: 1.0,
|
||||||
friction: 0.1,
|
friction: 0.1,
|
||||||
pitch: 0.0,
|
pitch: 1.0, // pitch=0/yaw=0 -> face sun
|
||||||
yaw: 0.0,
|
yaw: 0.3,
|
||||||
velocity: Vec3::ZERO,
|
velocity: Vec3::ZERO,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,10 +113,9 @@ fn run_camera_controller(
|
||||||
|
|
||||||
if let Ok((mut transform, mut controller)) = query.get_single_mut() {
|
if let Ok((mut transform, mut controller)) = query.get_single_mut() {
|
||||||
if !controller.initialized {
|
if !controller.initialized {
|
||||||
let (yaw, pitch, _roll) = transform.rotation.to_euler(EulerRot::YXZ);
|
|
||||||
controller.yaw = yaw;
|
|
||||||
controller.pitch = pitch;
|
|
||||||
controller.initialized = true;
|
controller.initialized = true;
|
||||||
|
transform.rotation =
|
||||||
|
Quat::from_euler(EulerRot::ZYX, 0.0, controller.yaw, controller.pitch);
|
||||||
*toggle_cursor_grab = true;
|
*toggle_cursor_grab = true;
|
||||||
info!("{}", *controller);
|
info!("{}", *controller);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue