diff --git a/Source/Engine/Physics/Actors/WheeledVehicle.cpp b/Source/Engine/Physics/Actors/WheeledVehicle.cpp index 11157783e..010add151 100644 --- a/Source/Engine/Physics/Actors/WheeledVehicle.cpp +++ b/Source/Engine/Physics/Actors/WheeledVehicle.cpp @@ -190,6 +190,11 @@ void WheeledVehicle::SetThrottle(float value) _throttle = Math::Clamp(value, -1.0f, 1.0f); } +float WheeledVehicle::GetThrottle() +{ + return _throttle; +} + void WheeledVehicle::SetSteering(float value) { _steering = Math::Clamp(value, -1.0f, 1.0f); diff --git a/Source/Engine/Physics/Actors/WheeledVehicle.h b/Source/Engine/Physics/Actors/WheeledVehicle.h index 16e226546..fe518a41d 100644 --- a/Source/Engine/Physics/Actors/WheeledVehicle.h +++ b/Source/Engine/Physics/Actors/WheeledVehicle.h @@ -541,6 +541,12 @@ public: /// The value (-1,1 range). When using UseReverseAsBrake it can be negative and will be used as brake and backward driving. API_FUNCTION() void SetThrottle(float value); + /// + /// Get the vehicle throttle. It is the analog accelerator pedal value in range (0,1) where 1 represents the pedal fully pressed and 0 represents the pedal in its rest state. + /// + /// The vehicle throttle. + API_FUNCTION() float GetThrottle(); + /// /// Sets the input for vehicle steering. Steer is the analog steer value in range (-1,1) where -1 represents the steering wheel at left lock and +1 represents the steering wheel at right lock. ///