From e6b41d35c427dab4bf2bbdd38866d43a36f8829c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Fri, 19 Nov 2021 19:06:40 +0100 Subject: [PATCH] Fix automatic reverse to 1st gear transmission --- vehicles/vehicle.gd | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/vehicles/vehicle.gd b/vehicles/vehicle.gd index 8c09b19..f75c3d5 100644 --- a/vehicles/vehicle.gd +++ b/vehicles/vehicle.gd @@ -139,11 +139,6 @@ func _physics_process(delta: float): var wheel_rpm = traction_wheels[0].get_rpm() var speed = wheel_rpm * 2.0 * PI * rrwheel.wheel_radius / 60.0 * 3600.0 / 1000.0 - if GlobalSettings.automatic_transmission and gear == -1: - var swap = throttle - throttle = brake_input - brake_input = swap - if ( GlobalSettings.automatic_transmission and speed >= 0 @@ -154,6 +149,21 @@ func _physics_process(delta: float): _gear_down() _gear_down() + if ( + GlobalSettings.automatic_transmission + and speed <= 0 + and speed > -1 + and gear == -1 + and throttle > 0.1 + ): + _gear_up() + _gear_up() + + if GlobalSettings.automatic_transmission and gear == -1: + var swap = throttle + throttle = brake_input + brake_input = swap + if GlobalSettings.auto_clutch or GlobalSettings.automatic_transmission: clutch_position = 1 - min(rpm, 900) / 900.0