From e44ecaabcd5986e6758795956bc7073c083ae56a Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 5 Apr 2024 23:10:40 +0200 Subject: [PATCH] fix overshoot calculation when matching velocity --- src/camera.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/camera.rs b/src/camera.rs index a5ae187..cc6d90d 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -227,7 +227,7 @@ pub fn apply_input_to_player( let threshold = 1e-5; if key_input.pressed(settings.key_stop) { // Decelerate - let dv = target_v - v.0; + let dv = v.0 - target_v; for i in 0..3 { if dv[i].abs() < threshold { v[i] = target_v[i];