From 8a07e9cfb7cc52342ca6caa848681576b5aaa712 Mon Sep 17 00:00:00 2001 From: yuni Date: Wed, 22 May 2024 23:54:11 +0200 Subject: [PATCH] cleanup --- src/actor.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/actor.rs b/src/actor.rs index d5d43a8..f5281d2 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -543,17 +543,15 @@ fn handle_wants_maxvelocity( if total > maxv.0 { v.0 = DVec3::splat(0.0); } - // already not moving - continue; - } - - // TODO: respect engine parameters for different thrusts for different directions - let avg_thrust = - (engine.thrust_forward + engine.thrust_back + engine.thrust_sideways) / 3.0; - let acceleration = (avg_thrust * dt) as f64 * -v.0; - v.0 += acceleration; - if v.0.length() + EPSILON < acceleration.length() { - v.0 = DVec3::splat(0.0); + } else { + // TODO: respect engine parameters for different thrusts for different directions + let avg_thrust = + (engine.thrust_forward + engine.thrust_back + engine.thrust_sideways) / 3.0; + let acceleration = (avg_thrust * dt) as f64 * -v.0; + v.0 += acceleration; + if v.0.length() + EPSILON < acceleration.length() { + v.0 = DVec3::splat(0.0); + } } } }