WIP stop key 2
This commit is contained in:
parent
65c843f55f
commit
add6605a9a
|
@ -81,10 +81,10 @@ fn run_camera_controller(
|
||||||
let mut axis_input = Vec3::ZERO;
|
let mut axis_input = Vec3::ZERO;
|
||||||
if focused {
|
if focused {
|
||||||
if key_input.pressed(settings.key_forward) {
|
if key_input.pressed(settings.key_forward) {
|
||||||
axis_input.z += 1.0;
|
axis_input.z -= 1.0;
|
||||||
}
|
}
|
||||||
if key_input.pressed(settings.key_back) {
|
if key_input.pressed(settings.key_back) {
|
||||||
axis_input.z -= 1.0;
|
axis_input.z += 1.0;
|
||||||
}
|
}
|
||||||
if key_input.pressed(settings.key_right) {
|
if key_input.pressed(settings.key_right) {
|
||||||
axis_input.x += 1.0;
|
axis_input.x += 1.0;
|
||||||
|
@ -119,22 +119,16 @@ fn run_camera_controller(
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
let forward = *transform.forward();
|
let forward_factor = engine.current_warmup * (if axis_input.z < 0.0 {
|
||||||
let right = *transform.right();
|
|
||||||
let up = *transform.up();
|
|
||||||
|
|
||||||
let forward_factor = engine.current_warmup * (if axis_input.z > 0.0 {
|
|
||||||
engine.thrust_forward
|
engine.thrust_forward
|
||||||
} else {
|
} else {
|
||||||
engine.thrust_back
|
engine.thrust_back
|
||||||
});
|
});
|
||||||
let right_factor = engine.thrust_sideways * engine.current_warmup;
|
let right_factor = engine.thrust_sideways * engine.current_warmup;
|
||||||
let up_factor = engine.thrust_sideways * engine.current_warmup;
|
let up_factor = engine.thrust_sideways * engine.current_warmup;
|
||||||
|
let factor = Vec3::new(right_factor, up_factor, forward_factor);
|
||||||
|
|
||||||
let acceleration_global
|
let acceleration_global = transform.rotation * (acceleration_camera * factor);
|
||||||
= acceleration_camera.x * right * right_factor
|
|
||||||
+ acceleration_camera.y * up * up_factor
|
|
||||||
+ acceleration_camera.z * forward * forward_factor;
|
|
||||||
|
|
||||||
let speed_multiplier = 30.0;
|
let speed_multiplier = 30.0;
|
||||||
actor.v += speed_multiplier * dt * acceleration_global;
|
actor.v += speed_multiplier * dt * acceleration_global;
|
||||||
|
|
Loading…
Reference in a new issue