From 57d651ad045b518584ee301059247b9ccda7d0d6 Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 29 Mar 2024 01:19:37 +0100 Subject: [PATCH] cleanup --- src/camera.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/camera.rs b/src/camera.rs index 2f4a096..0924829 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -22,8 +22,6 @@ pub struct CameraController { pub enabled: bool, pub initialized: bool, pub sensitivity: f32, - pub move_speed: f32, - pub friction: f32, pub pitch: f32, pub yaw: f32, } @@ -34,8 +32,6 @@ impl Default for CameraController { enabled: true, initialized: false, sensitivity: 0.5, - move_speed: 30.0, - friction: 0.05, pitch: 1.0, // pitch=0/yaw=0 -> face sun yaw: 0.3, } @@ -105,7 +101,6 @@ fn run_camera_controller( } if key_input.pressed(settings.key_stop) { - actor.v = actor.v * (1.0 - controller.friction); if actor.v.length_squared() < 1e-6 { actor.v = Vec3::ZERO; } @@ -116,7 +111,7 @@ fn run_camera_controller( // Apply movement update let acceleration: Vec3; if axis_input != Vec3::ZERO { - acceleration = axis_input.normalize() * controller.move_speed; + acceleration = axis_input.normalize(); engine.current_warmup = (engine.current_warmup + dt / engine.warmup_seconds).clamp(0.0, 1.0); play_thruster_sound = !settings.mute_sfx; } else { @@ -131,9 +126,12 @@ fn run_camera_controller( }); let right = *transform.right() * engine.thrust_sideways * engine.current_warmup; let up = *transform.up() * engine.thrust_sideways * engine.current_warmup; - actor.v += acceleration.x * dt * right - + acceleration.y * dt * up - + acceleration.z * dt * forward; + + let speed_multiplier = 30.0; + actor.v += speed_multiplier * dt * + ( acceleration.x * right + + acceleration.y * up + + acceleration.z * forward); // Handle mouse input let mut mouse_delta = Vec2::ZERO;