From 0e5ca96054784a12fb506fa7b84f955a7bee2af1 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Fri, 22 Dec 2023 21:23:21 +0100 Subject: [PATCH 1/2] Remove some commented out code --- src/geoview.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/geoview.rs b/src/geoview.rs index cc82183..03c300c 100644 --- a/src/geoview.rs +++ b/src/geoview.rs @@ -1,6 +1,5 @@ use super::geocoord::*; use crate::player::Player; -//use bevy::prelude::*; use bevy::{ prelude::*, utils::tracing::{self, instrument}, From 7514a3d7fe91ab7432ef25b623b66745b822d94e Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Fri, 22 Dec 2023 21:53:57 +0100 Subject: [PATCH 2/2] Reorient "up" axis when moving --- src/lib.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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(