From e15cf6791f175113e32753e9181b26aec421afc8 Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 30 Mar 2024 17:05:32 +0100 Subject: [PATCH] fix new camera control system to work with vehicles --- src/camera.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/camera.rs b/src/camera.rs index 09ce3b1..5cb3ba7 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -51,7 +51,7 @@ fn setup_camera( pub fn sync_camera_to_player( settings: Res, mut q_camera: Query<&mut Transform, With>, - q_playercam: Query<(&actor::Actor, &Transform), (With, Without, Without)>, + q_playercam: Query<(&actor::Actor, &Transform), (With, Without)>, ) { if q_camera.is_empty() || q_playercam.is_empty() { return; @@ -119,13 +119,12 @@ fn apply_input_to_player( thruster_sound_controller: Query<&AudioSink, With>, rocket_sound_controller: Query<&AudioSink, With>, ion_sound_controller: Query<&AudioSink, With>, - mut q_engine: Query<&mut actor::Engine, With>, mut q_playercam: Query<( &mut Transform, &mut actor::Engine, &mut AngularVelocity, &mut LinearVelocity, - ), (With, Without, Without)>, + ), (With, Without)>, ) { let dt = time.delta_seconds(); let mut play_thruster_sound = false; @@ -136,7 +135,7 @@ fn apply_input_to_player( focused = window_result.unwrap().focused; } - if let Ok((mut player_transform, player_engine, mut angularvelocity, mut v)) = q_playercam.get_single_mut() { + if let Ok((mut player_transform, mut engine, mut angularvelocity, mut v)) = q_playercam.get_single_mut() { if angularvelocity.length_squared() > 0.0001 { angularvelocity.x *= 0.98; @@ -182,8 +181,6 @@ fn apply_input_to_player( // total diagonal acceleration is faster than the forward acceleration alone. axis_input = axis_input.clamp(Vec3::splat(-1.0), Vec3::splat(1.0)); - let mut engine = if let Ok(engine) = q_engine.get_single_mut() { engine } else { player_engine }; - // Apply movement update let forward_factor = engine.current_warmup * (if axis_input.z < 0.0 { engine.thrust_forward