From 65c843f55f8b4454b794713d9db70b9f784deb04 Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 29 Mar 2024 01:40:58 +0100 Subject: [PATCH] WIP stop key --- src/camera.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/camera.rs b/src/camera.rs index 03d2ce1..46001ef 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -119,17 +119,22 @@ fn run_camera_controller( engine.current_warmup = (engine.current_warmup - dt / engine.warmup_seconds).clamp(0.0, 1.0); } - let forward = *transform.forward() * engine.current_warmup * (if axis_input.z > 0.0 { + let forward = *transform.forward(); + let right = *transform.right(); + let up = *transform.up(); + + let forward_factor = engine.current_warmup * (if axis_input.z > 0.0 { engine.thrust_forward } else { engine.thrust_back }); - let right = *transform.right() * engine.thrust_sideways * engine.current_warmup; - let up = *transform.up() * 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 acceleration_global - = acceleration_camera.x * right - + acceleration_camera.y * up - + acceleration_camera.z * forward; + = acceleration_camera.x * right * right_factor + + acceleration_camera.y * up * up_factor + + acceleration_camera.z * forward * forward_factor; let speed_multiplier = 30.0; actor.v += speed_multiplier * dt * acceleration_global;