From d4114f01c0e42bcfc7053f711f38695675d9d7b8 Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 17 Mar 2024 00:48:23 +0100 Subject: [PATCH] disable friction, thrusters now accelerate instead of move --- src/camera.rs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/camera.rs b/src/camera.rs index cdcb025..7224447 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -31,8 +31,7 @@ pub struct CameraController { pub key_run: KeyCode, pub mouse_key_cursor_grab: MouseButton, pub keyboard_key_toggle_cursor_grab: KeyCode, - pub walk_speed: f32, - pub run_speed: f32, + pub move_speed: f32, pub friction: f32, pub pitch: f32, pub yaw: f32, @@ -54,9 +53,8 @@ impl Default for CameraController { key_run: KeyCode::KeyR, mouse_key_cursor_grab: MouseButton::Left, keyboard_key_toggle_cursor_grab: KeyCode::KeyM, - walk_speed: 5.0, - run_speed: 15.0, - friction: 0.5, + move_speed: 1.0, + friction: 0.0, pitch: 0.0, yaw: 0.0, velocity: Vec3::ZERO, @@ -161,12 +159,8 @@ fn run_camera_controller( // Apply movement update if axis_input != Vec3::ZERO { - let max_speed = if key_input.pressed(controller.key_run) { - controller.run_speed - } else { - controller.walk_speed - }; - controller.velocity = axis_input.normalize() * max_speed; + let new_velocity = controller.velocity + axis_input.normalize() * controller.move_speed; + controller.velocity = new_velocity; play_thruster_sound = true; } else { let friction = controller.friction.clamp(0.0, 1.0);