From fdce4410dba115792e7b11ba8235fc58c056114a Mon Sep 17 00:00:00 2001 From: "Elijah C. Voigt" Date: Thu, 13 Jun 2024 10:37:39 -0700 Subject: [PATCH] Break fly cam into move and rotate systems --- src/camera.rs | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/src/camera.rs b/src/camera.rs index 9ce5c28..0f50cc5 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -1,5 +1,3 @@ -use bevy::input::mouse::MouseButtonInput; - use crate::prelude::*; /// Menu Plugin; empty struct for Plugin impl @@ -7,7 +5,8 @@ pub(crate) struct CameraPlugin; impl Plugin for CameraPlugin { fn build(&self, app: &mut App) { - app.add_systems(Update, editor_fly_camera); + app.add_systems(Update, move_editor_fly_camera); + app.add_systems(Update, rotate_editor_fly_camera); } } @@ -16,19 +15,21 @@ pub(crate) struct FlyCamera; /// Fly camera system for moving around like a drone /// TODO: Only if key is pressed! -fn editor_fly_camera( +fn move_editor_fly_camera( mut cameras: Query<(&Camera, &mut Transform), With>, windows: Query<&Window>, primary_window: Query>, keys: Res>, - mouse: Res>, - mut cursor_events: EventReader, time: Res