From 46a3dc704ab77b86fc75438b0b8201ae2e8175fa Mon Sep 17 00:00:00 2001 From: Dustin Date: Sun, 27 Apr 2025 09:48:48 -0700 Subject: [PATCH] Closest roll yet. Still missing something. --- lib/classes/movement_state_receiver.gd | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/classes/movement_state_receiver.gd b/lib/classes/movement_state_receiver.gd index c172492..b24b8a3 100644 --- a/lib/classes/movement_state_receiver.gd +++ b/lib/classes/movement_state_receiver.gd @@ -213,7 +213,12 @@ func new_move_actor_as_desired(_delta :float, if calc_inertia.x == 0.0: calc_inertia.x = h_speed.x ## Apply acceleration - calc_inertia.x = move_toward(calc_inertia.x, h_speed.y, (calc_acceleration.x * _delta)) + if h_speed.y > h_speed.x: + calc_inertia.x = move_toward(calc_inertia.x, h_speed.y, (calc_acceleration.x * _delta)) + else: + ## use of move_toward forcing need to apply negative accel as postitive. + calc_inertia.x = move_toward(calc_inertia.x, h_speed.y, abs(calc_acceleration.x * _delta)) + ## Apply friction calc_inertia.x = move_toward(calc_inertia.x, 0, (calc_friction.x * _delta)) # calc_inertia.x = clamp( calc_inertia.x + (calc_friction.x * _delta),