cleanup
This commit is contained in:
parent
57d651ad04
commit
b96eb701ab
|
@ -109,13 +109,13 @@ fn run_camera_controller(
|
||||||
let mut engine = if let Ok(engine) = q_engine.get_single_mut() { engine } else { player_engine };
|
let mut engine = if let Ok(engine) = q_engine.get_single_mut() { engine } else { player_engine };
|
||||||
|
|
||||||
// Apply movement update
|
// Apply movement update
|
||||||
let acceleration: Vec3;
|
let acceleration_camera: Vec3;
|
||||||
if axis_input != Vec3::ZERO {
|
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);
|
engine.current_warmup = (engine.current_warmup + dt / engine.warmup_seconds).clamp(0.0, 1.0);
|
||||||
play_thruster_sound = !settings.mute_sfx;
|
play_thruster_sound = !settings.mute_sfx;
|
||||||
} else {
|
} else {
|
||||||
acceleration = Vec3::ZERO;
|
acceleration_camera = Vec3::ZERO;
|
||||||
engine.current_warmup = (engine.current_warmup - dt / engine.warmup_seconds).clamp(0.0, 1.0);
|
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 right = *transform.right() * engine.thrust_sideways * engine.current_warmup;
|
||||||
let up = *transform.up() * 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;
|
let speed_multiplier = 30.0;
|
||||||
actor.v += speed_multiplier * dt *
|
actor.v += speed_multiplier * dt * acceleration_global;
|
||||||
( acceleration.x * right
|
|
||||||
+ acceleration.y * up
|
|
||||||
+ acceleration.z * forward);
|
|
||||||
|
|
||||||
// Handle mouse input
|
// Handle mouse input
|
||||||
let mut mouse_delta = Vec2::ZERO;
|
let mut mouse_delta = Vec2::ZERO;
|
||||||
|
|
Loading…
Reference in a new issue