From 2b4fd9e5b5485bbf5da53293e8684c302914b6f7 Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 29 Mar 2024 03:31:15 +0100 Subject: [PATCH] cleanup --- src/camera.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/camera.rs b/src/camera.rs index 1ad754b..daaf74d 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -133,7 +133,8 @@ fn run_camera_controller( if actor.v[i].abs() < threshold { actor.v[i] = 0.0; } - else if (actor.v[i] < 0.0 && actor.v[i] + acceleration_total[i] > 0.0) || (actor.v[i] > 0.0 && actor.v[i] + acceleration_total[i] < 0.0) { + else if actor.v[i].signum() != (actor.v[i] + acceleration_total[i]).signum() { + // Overshoot actor.v[i] = 0.0; acceleration_total[i] = 0.0; }