disable friction, thrusters now accelerate instead of move

This commit is contained in:
yuni 2024-03-17 00:48:23 +01:00
parent 5471b46c03
commit d4114f01c0

View file

@ -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);