Skip to content

Commit

Permalink
Merge pull request #69 from oli-obk/cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
DerKarlos authored Dec 22, 2023
2 parents a0339f2 + 7514a3d commit aa427c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/geoview.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::geocoord::*;
use crate::player::Player;
//use bevy::prelude::*;
use bevy::{
prelude::*,
utils::tracing::{self, instrument},
Expand Down
13 changes: 10 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,21 @@ fn reposition_compass(

fn update_camera_orientations(
mut movement_settings: ResMut<MovementSettings>,
fly_cam: Query<GalacticTransform, With<FlyCam>>,
mut fly_cam: Query<GalacticTransform, With<FlyCam>>,
space: Res<FloatingOriginSettings>,
) {
movement_settings.up = fly_cam
.single() // the only FlyCam's calactic position <grid,f32>
// the only FlyCam's calactic position <grid,f32>
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(
Expand Down

0 comments on commit aa427c5

Please sign in to comment.