diff --git a/src/camera.rs b/src/camera.rs new file mode 100644 index 0000000..95d19af --- /dev/null +++ b/src/camera.rs @@ -0,0 +1,127 @@ +use crate::prelude::*; + +/// Menu Plugin; empty struct for Plugin impl +pub(crate) struct CameraPlugin; + +impl Plugin for CameraPlugin { + fn build(&self, app: &mut App) { + app.add_systems( + Update, + move_editor_fly_camera.run_if(any_with_component::), + ); + app.add_systems( + Update, + rotate_editor_fly_camera.run_if(any_with_component::), + ); + } +} + +#[derive(Component)] +pub(crate) struct FlyCamera; + +/// Fly camera system for moving around like a drone +/// TODO: Only if key is pressed! +fn move_editor_fly_camera( + mut cameras: Query<(&Camera, &mut Transform), With>, + windows: Query<&Window>, + primary_window: Query>, + keys: Res>, + time: Res