From cd9f04025800df513151cb91aecc01524aed65108a0b3d6f8833a80cdddf8713 Mon Sep 17 00:00:00 2001 From: Stef Date: Wed, 24 Dec 2025 11:55:03 +0100 Subject: [PATCH] Added mouse controls --- app/src/main.rs | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/app/src/main.rs b/app/src/main.rs index 86a3e3d..9afa646 100644 --- a/app/src/main.rs +++ b/app/src/main.rs @@ -1,14 +1,18 @@ +use std::ops::Add; +use bevy::input::mouse::MouseMotion; +use bevy::log; use bevy::prelude::*; // Core Bevy types const GRAVITY: f32 = -0.981; const CAMERA_SPEED: f32 = 20.0; // units per second +const CAMERA_SENSITIVITY: f32 = 1.0; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup) .add_systems(Update, (apply_gravity, velocity_timestep).chain()) - .add_systems(Update, move_camera) + .add_systems(Update, (camera_movement_controller, camera_rotation_controller)) .run(); } @@ -44,6 +48,8 @@ fn setup( Camera3d::default(), Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y), )); + + log::info!("Setup finished"); } #[derive(Component)] @@ -61,7 +67,7 @@ fn apply_gravity(time: Res