diff --git a/Source/Engine/Physics/Actors/WheeledVehicle.cpp b/Source/Engine/Physics/Actors/WheeledVehicle.cpp
index 35f78f39f..fadc5fe19 100644
--- a/Source/Engine/Physics/Actors/WheeledVehicle.cpp
+++ b/Source/Engine/Physics/Actors/WheeledVehicle.cpp
@@ -201,6 +201,11 @@ void WheeledVehicle::SetSteering(float value)
_steering = Math::Clamp(value, -1.0f, 1.0f);
}
+float WheeledVehicle::GetSteering()
+{
+ return _steering;
+}
+
void WheeledVehicle::SetBrake(float value)
{
value = Math::Saturate(value);
@@ -209,11 +214,21 @@ void WheeledVehicle::SetBrake(float value)
_tankRightBrake = value;
}
+float WheeledVehicle::GetBrake()
+{
+ return _brake;
+}
+
void WheeledVehicle::SetHandbrake(float value)
{
_handBrake = Math::Saturate(value);
}
+float WheeledVehicle::GetHandbrake()
+{
+ return _handBrake;
+}
+
void WheeledVehicle::SetTankLeftThrottle(float value)
{
_tankLeftThrottle = Math::Clamp(value, -1.0f, 1.0f);
@@ -387,6 +402,7 @@ void WheeledVehicle::DrawPhysicsDebug(RenderView& view)
void WheeledVehicle::OnDebugDrawSelected()
{
// Wheels shapes
+ int32 wheelIndex = 0;
for (const auto& wheel : _wheels)
{
if (wheel.Collider && wheel.Collider->GetParent() == this && !wheel.Collider->GetIsTrigger())
@@ -423,14 +439,20 @@ void WheeledVehicle::OnDebugDrawSelected()
{
DEBUG_DRAW_WIRE_SPHERE(BoundingSphere(data.State.TireContactPoint, 5.0f), Color::Green, 0, false);
}
+ if (ShowDebugDrawWheelNames)
+ {
+ const String text = String::Format(TEXT("Index: {}\nCollider: {}"), wheelIndex, wheel.Collider->GetName());
+ DEBUG_DRAW_TEXT(text, currentPos, Color::Blue, 10, 0);
+ }
}
+ wheelIndex++;
}
// Anti roll bars axes
const int32 wheelsCount = _wheels.Count();
- for (int32 i = 0; i < GetAntiRollBars().Count(); i++)
+ for (int32 i = 0; i < _antiRollBars.Count(); i++)
{
- const int32 axleIndex = GetAntiRollBars()[i].Axle;
+ const int32 axleIndex = _antiRollBars[i].Axle;
const int32 leftWheelIndex = axleIndex * 2;
const int32 rightWheelIndex = leftWheelIndex + 1;
if (leftWheelIndex >= wheelsCount || rightWheelIndex >= wheelsCount)
diff --git a/Source/Engine/Physics/Actors/WheeledVehicle.h b/Source/Engine/Physics/Actors/WheeledVehicle.h
index 390c0e24a..4b5e9f058 100644
--- a/Source/Engine/Physics/Actors/WheeledVehicle.h
+++ b/Source/Engine/Physics/Actors/WheeledVehicle.h
@@ -468,10 +468,18 @@ public:
API_FIELD(Attributes="EditorOrder(1), EditorDisplay(\"Vehicle\")")
bool UseAnalogSteering = false;
+#if USE_EDITOR
+ ///
+ /// If checked, will draw wheel names and indices at the position of their colliders.
+ ///
+ API_FIELD(Attributes="EditorOrder(2), EditorDisplay(\"Vehicle\")")
+ bool ShowDebugDrawWheelNames = false;
+#endif
+
///
/// Gets the vehicle driving model type.
///
- API_PROPERTY(Attributes="EditorOrder(2), EditorDisplay(\"Vehicle\")") DriveTypes GetDriveType() const;
+ API_PROPERTY(Attributes="EditorOrder(4), EditorDisplay(\"Vehicle\")") DriveTypes GetDriveType() const;
///
/// Sets the vehicle driving model type.
@@ -481,12 +489,12 @@ public:
///
/// Gets the vehicle wheels settings.
///
- API_PROPERTY(Attributes="EditorOrder(4), EditorDisplay(\"Vehicle\")") const Array& GetWheels() const;
+ API_PROPERTY(Attributes="EditorOrder(5), EditorDisplay(\"Vehicle\")") const Array& GetWheels() const;
///
/// Gets the vehicle drive control settings.
///
- API_PROPERTY(Attributes="EditorOrder(5), EditorDisplay(\"Vehicle\")") DriveControlSettings GetDriveControl() const;
+ API_PROPERTY(Attributes="EditorOrder(6), EditorDisplay(\"Vehicle\")") DriveControlSettings GetDriveControl() const;
///
/// Sets the vehicle drive control settings.
@@ -501,7 +509,7 @@ public:
///
/// Gets the vehicle engine settings.
///
- API_PROPERTY(Attributes="EditorOrder(6), EditorDisplay(\"Vehicle\")") EngineSettings GetEngine() const;
+ API_PROPERTY(Attributes="EditorOrder(7), EditorDisplay(\"Vehicle\")") EngineSettings GetEngine() const;
///
/// Sets the vehicle engine settings.
@@ -511,7 +519,7 @@ public:
///
/// Gets the vehicle differential settings.
///
- API_PROPERTY(Attributes="EditorOrder(7), EditorDisplay(\"Vehicle\")") DifferentialSettings GetDifferential() const;
+ API_PROPERTY(Attributes="EditorOrder(8), EditorDisplay(\"Vehicle\")") DifferentialSettings GetDifferential() const;
///
/// Sets the vehicle differential settings.
@@ -521,7 +529,7 @@ public:
///
/// Gets the vehicle gearbox settings.
///
- API_PROPERTY(Attributes="EditorOrder(8), EditorDisplay(\"Vehicle\")") GearboxSettings GetGearbox() const;
+ API_PROPERTY(Attributes="EditorOrder(9), EditorDisplay(\"Vehicle\")") GearboxSettings GetGearbox() const;
///
/// Sets the vehicle gearbox settings.
@@ -531,7 +539,7 @@ public:
//
/// Sets axles anti roll bars to increase vehicle stability.
///
- API_PROPERTY() void SetAntiRollBars(const Array& value);
+ API_PROPERTY(Attributes="EditorOrder(10), EditorDisplay(\"Vehicle\")") void SetAntiRollBars(const Array& value);
//
/// Gets axles anti roll bars.
@@ -557,18 +565,36 @@ public:
/// The value (-1,1 range).
API_FUNCTION() void SetSteering(float value);
+ ///
+ /// Gets the 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.
+ ///
+ /// The vehicle steering.
+ API_FUNCTION() float GetSteering();
+
///
/// Sets the input for vehicle brakes. Brake is the analog brake pedal value in range (0,1) where 1 represents the pedal fully pressed and 0 represents the pedal in its rest state.
///
/// The value (0,1 range).
API_FUNCTION() void SetBrake(float value);
+ ///
+ /// Gets the vehicle brakes. Brake is the analog brake pedal value in range (0,1) where 1 represents the pedal fully pressed and 0 represents the pedal in its rest state.
+ ///
+ /// The vehicle brake.
+ API_FUNCTION() float GetBrake();
+
///
/// Sets the input for vehicle handbrake. Handbrake is the analog handbrake value in range (0,1) where 1 represents the handbrake fully engaged and 0 represents the handbrake in its rest state.
///
/// The value (0,1 range).
API_FUNCTION() void SetHandbrake(float value);
+ ///
+ /// Gets the vehicle handbrake. Handbrake is the analog handbrake value in range (0,1) where 1 represents the handbrake fully engaged and 0 represents the handbrake in its rest state.
+ ///
+ /// The vehicle handbrake.
+ API_FUNCTION() float GetHandbrake();
+
///
/// Sets the input for tank left track throttle. It is the analog accelerator pedal value in range (-1,1) where 1 represents the pedal fully pressed to move to forward, 0 to represents the
/// pedal in its rest state and -1 represents the pedal fully pressed to move to backward. The track direction will be inverted if the vehicle current gear is rear.