cleanup
This commit is contained in:
parent
33bb26b8e1
commit
57d651ad04
|
@ -22,8 +22,6 @@ pub struct CameraController {
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
pub initialized: bool,
|
pub initialized: bool,
|
||||||
pub sensitivity: f32,
|
pub sensitivity: f32,
|
||||||
pub move_speed: f32,
|
|
||||||
pub friction: f32,
|
|
||||||
pub pitch: f32,
|
pub pitch: f32,
|
||||||
pub yaw: f32,
|
pub yaw: f32,
|
||||||
}
|
}
|
||||||
|
@ -34,8 +32,6 @@ impl Default for CameraController {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
initialized: false,
|
initialized: false,
|
||||||
sensitivity: 0.5,
|
sensitivity: 0.5,
|
||||||
move_speed: 30.0,
|
|
||||||
friction: 0.05,
|
|
||||||
pitch: 1.0, // pitch=0/yaw=0 -> face sun
|
pitch: 1.0, // pitch=0/yaw=0 -> face sun
|
||||||
yaw: 0.3,
|
yaw: 0.3,
|
||||||
}
|
}
|
||||||
|
@ -105,7 +101,6 @@ fn run_camera_controller(
|
||||||
}
|
}
|
||||||
|
|
||||||
if key_input.pressed(settings.key_stop) {
|
if key_input.pressed(settings.key_stop) {
|
||||||
actor.v = actor.v * (1.0 - controller.friction);
|
|
||||||
if actor.v.length_squared() < 1e-6 {
|
if actor.v.length_squared() < 1e-6 {
|
||||||
actor.v = Vec3::ZERO;
|
actor.v = Vec3::ZERO;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +111,7 @@ fn run_camera_controller(
|
||||||
// Apply movement update
|
// Apply movement update
|
||||||
let acceleration: Vec3;
|
let acceleration: Vec3;
|
||||||
if axis_input != Vec3::ZERO {
|
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);
|
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 {
|
||||||
|
@ -131,9 +126,12 @@ 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;
|
||||||
actor.v += acceleration.x * dt * right
|
|
||||||
+ acceleration.y * dt * up
|
let speed_multiplier = 30.0;
|
||||||
+ acceleration.z * dt * forward;
|
actor.v += speed_multiplier * dt *
|
||||||
|
( 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