From 967569c3e27b222b7735df2ad145dfab8d41cc2a Mon Sep 17 00:00:00 2001 From: "Mr. Capybara" Date: Sun, 31 Dec 2023 22:43:04 -0400 Subject: [PATCH] Small fix vehicle tank inputs --- Source/Engine/Physics/PhysX/PhysicsBackendPhysX.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Engine/Physics/PhysX/PhysicsBackendPhysX.cpp b/Source/Engine/Physics/PhysX/PhysicsBackendPhysX.cpp index e55b80008..cb1d094a4 100644 --- a/Source/Engine/Physics/PhysX/PhysicsBackendPhysX.cpp +++ b/Source/Engine/Physics/PhysX/PhysicsBackendPhysX.cpp @@ -1403,8 +1403,8 @@ void PhysicsBackend::EndSimulateScene(void* scene) // Converting default vehicle controls to tank controls. if (throttle != 0 || steering != 0) { - leftThrottle = throttle + steering; - rightThrottle = throttle - steering; + leftThrottle = Math::Clamp(throttle + steering, -1.0f, 1.0f); + rightThrottle = Math::Clamp(throttle - steering, -1.0f, 1.0f); } } @@ -1418,10 +1418,12 @@ void PhysicsBackend::EndSimulateScene(void* scene) if (leftThrottle < -deadZone && rightThrottle > deadZone) { leftThrottle = 0; + leftBrake = 1; } else if (leftThrottle > deadZone && rightThrottle < -deadZone) { rightThrottle = 0; + rightBrake = 1; } }