From 3f322ba0eabcc20b1fa5119b4cc6dc7f085f49a4 Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Sun, 19 Dec 2021 23:11:23 -0800 Subject: [PATCH] Shrink planet, get rotating visible lights near the surface. --- src/flycam.rs | 78 +++++++---------- src/main.rs | 230 +++++++++++++++++++++++++++++++++++++------------- 2 files changed, 201 insertions(+), 107 deletions(-) diff --git a/src/flycam.rs b/src/flycam.rs index 48847d2..5b87a09 100644 --- a/src/flycam.rs +++ b/src/flycam.rs @@ -26,31 +26,20 @@ impl Default for MovementSettings { fn default() -> Self { Self { sensitivity: 0.00012, - speed: 12., + speed: 40., } } } /// Used in queries when you want flycams and not other cameras -#[derive(Debug)] +#[derive(Component, Debug)] pub struct FlyCam; -/// Grabs/ungrabs mouse cursor -fn toggle_grab_cursor(window: &mut Window) { - window.set_cursor_lock_mode(!window.cursor_locked()); - window.set_cursor_visibility(!window.cursor_visible()); -} - -/// Grabs the cursor when game first starts -fn initial_grab_cursor(mut windows: ResMut) { - toggle_grab_cursor(windows.get_primary_mut().unwrap()); -} - /// Spawns the `Camera3dBundle` to be controlled fn setup_player(mut commands: Commands) { commands .spawn_bundle(PerspectiveCameraBundle { - transform: Transform::from_xyz(0.0, 0.0, -1200.0).looking_at(Vec3::ZERO, Vec3::Y), + transform: Transform::from_xyz(0.0, 100.0, -500.0).looking_at(Vec3::ZERO, Vec3::Y), ..Default::default() }) .insert(FlyCam); @@ -60,11 +49,9 @@ fn setup_player(mut commands: Commands) { fn player_move( keys: Res>, time: Res