fix overshoot calculation when matching velocity

This commit is contained in:
yuni 2024-04-05 23:10:40 +02:00
parent 704c249091
commit e44ecaabcd

View file

@ -227,7 +227,7 @@ pub fn apply_input_to_player(
let threshold = 1e-5; let threshold = 1e-5;
if key_input.pressed(settings.key_stop) { if key_input.pressed(settings.key_stop) {
// Decelerate // Decelerate
let dv = target_v - v.0; let dv = v.0 - target_v;
for i in 0..3 { for i in 0..3 {
if dv[i].abs() < threshold { if dv[i].abs() < threshold {
v[i] = target_v[i]; v[i] = target_v[i];