add wheel information debug draw

This commit is contained in:
xxSeys1
2025-04-02 19:12:36 +02:00
parent 2e48be97b6
commit dd281bbca8
2 changed files with 25 additions and 6 deletions

View File

@@ -424,6 +424,12 @@ void WheeledVehicle::OnDebugDrawSelected()
{
DEBUG_DRAW_WIRE_SPHERE(BoundingSphere(data.State.TireContactPoint, 5.0f), Color::Green, 0, false);
}
if (DisplayWheelInfo)
{
const String text = String::Format(TEXT("Index: {}\nCollider: {}"), wheelIndex, wheel.Collider->GetName());
DEBUG_DRAW_TEXT(text, currentPos, WheelInfoColor, 10, 0);
}
}
}

View File

@@ -5,6 +5,7 @@
#include "Engine/Physics/Actors/RigidBody.h"
#include "Engine/Physics/Colliders/Collider.h"
#include "Engine/Scripting/ScriptingObjectReference.h"
#include "Engine/Core/Math/Color.h"
/// <summary>
/// Representation of the car vehicle that uses wheels. Built on top of the RigidBody with collider representing its chassis shape and wheels.
@@ -464,10 +465,22 @@ public:
API_FIELD(Attributes="EditorOrder(1), EditorDisplay(\"Vehicle\")")
bool UseAnalogSteering = false;
/// <summary>
/// If checked, will draw some useful information about the wheels at the position of their colliders.
/// </summary>
API_FIELD(Attributes ="EditorOrder(2), EditorDisplay(\"Vehicle\")")
bool DisplayWheelInfo = false;
/// <summary>
/// If checked, will draw some useful information about the wheels at the position of their colliders.
/// </summary>
API_FIELD(Attributes = "EditorOrder(3), EditorDisplay(\"Vehicle\"), VisibleIf(\"DisplayWheelInfo\")")
Color WheelInfoColor = Color::White;
/// <summary>
/// Gets the vehicle driving model type.
/// </summary>
API_PROPERTY(Attributes="EditorOrder(2), EditorDisplay(\"Vehicle\")") DriveTypes GetDriveType() const;
API_PROPERTY(Attributes="EditorOrder(4), EditorDisplay(\"Vehicle\")") DriveTypes GetDriveType() const;
/// <summary>
/// Sets the vehicle driving model type.
@@ -477,12 +490,12 @@ public:
/// <summary>
/// Gets the vehicle wheels settings.
/// </summary>
API_PROPERTY(Attributes="EditorOrder(4), EditorDisplay(\"Vehicle\")") const Array<Wheel>& GetWheels() const;
API_PROPERTY(Attributes="EditorOrder(5), EditorDisplay(\"Vehicle\")") const Array<Wheel>& GetWheels() const;
/// <summary>
/// Gets the vehicle drive control settings.
/// </summary>
API_PROPERTY(Attributes = "EditorOrder(5), EditorDisplay(\"Vehicle\")") DriveControlSettings GetDriveControl() const;
API_PROPERTY(Attributes = "EditorOrder(6), EditorDisplay(\"Vehicle\")") DriveControlSettings GetDriveControl() const;
/// <summary>
/// Sets the vehicle drive control settings.
@@ -497,7 +510,7 @@ public:
/// <summary>
/// Gets the vehicle engine settings.
/// </summary>
API_PROPERTY(Attributes="EditorOrder(6), EditorDisplay(\"Vehicle\")") EngineSettings GetEngine() const;
API_PROPERTY(Attributes="EditorOrder(7), EditorDisplay(\"Vehicle\")") EngineSettings GetEngine() const;
/// <summary>
/// Sets the vehicle engine settings.
@@ -507,7 +520,7 @@ public:
/// <summary>
/// Gets the vehicle differential settings.
/// </summary>
API_PROPERTY(Attributes="EditorOrder(7), EditorDisplay(\"Vehicle\")") DifferentialSettings GetDifferential() const;
API_PROPERTY(Attributes="EditorOrder(8), EditorDisplay(\"Vehicle\")") DifferentialSettings GetDifferential() const;
/// <summary>
/// Sets the vehicle differential settings.
@@ -517,7 +530,7 @@ public:
/// <summary>
/// Gets the vehicle gearbox settings.
/// </summary>
API_PROPERTY(Attributes="EditorOrder(8), EditorDisplay(\"Vehicle\")") GearboxSettings GetGearbox() const;
API_PROPERTY(Attributes="EditorOrder(9), EditorDisplay(\"Vehicle\")") GearboxSettings GetGearbox() const;
/// <summary>
/// Sets the vehicle gearbox settings.