This commit is contained in:
yuni 2024-03-29 01:31:02 +01:00
parent 57d651ad04
commit b96eb701ab

View file

@ -109,13 +109,13 @@ fn run_camera_controller(
let mut engine = if let Ok(engine) = q_engine.get_single_mut() { engine } else { player_engine };
// Apply movement update
let acceleration: Vec3;
let acceleration_camera: Vec3;
if axis_input != Vec3::ZERO {
acceleration = axis_input.normalize();
acceleration_camera = 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 {
acceleration = Vec3::ZERO;
acceleration_camera = Vec3::ZERO;
engine.current_warmup = (engine.current_warmup - dt / engine.warmup_seconds).clamp(0.0, 1.0);
}
@ -126,12 +126,13 @@ fn run_camera_controller(
});
let right = *transform.right() * engine.thrust_sideways * engine.current_warmup;
let up = *transform.up() * engine.thrust_sideways * engine.current_warmup;
let acceleration_global
= acceleration_camera.x * right
+ acceleration_camera.y * up
+ acceleration_camera.z * forward;
let speed_multiplier = 30.0;
actor.v += speed_multiplier * dt *
( acceleration.x * right
+ acceleration.y * up
+ acceleration.z * forward);
actor.v += speed_multiplier * dt * acceleration_global;
// Handle mouse input
let mut mouse_delta = Vec2::ZERO;