diff --git a/src/lib.rs b/src/lib.rs index 15206b1..e02b85e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -326,14 +326,21 @@ fn reposition_compass( fn update_camera_orientations( mut movement_settings: ResMut, - fly_cam: Query>, + mut fly_cam: Query>, space: Res, ) { - movement_settings.up = fly_cam - .single() // the only FlyCam's calactic position + // the only FlyCam's calactic position + let mut fly_cam = fly_cam.single_mut(); + + let up = fly_cam .position_double(&space) .normalize() // direction from galactic NULL = from the Earth center .as_vec3(); + movement_settings.up = up; + + // Reorient "up" axis without introducing other rotations. + let forward = fly_cam.transform.forward(); + fly_cam.transform.look_to(forward, up); } fn pull_to_ground(