Expose Setup on WheeledVehicle

This commit is contained in:
Wojtek Figat
2021-03-29 16:40:06 +02:00
parent f17e347a15
commit 6ad8e8b133
2 changed files with 8 additions and 10 deletions

View File

@@ -58,10 +58,7 @@ void WheeledVehicle::SetDriveType(DriveTypes value)
if (_driveType == value)
return;
_driveType = value;
if (IsDuringPlay())
{
Setup();
}
Setup();
}
const Array<WheeledVehicle::Wheel>& WheeledVehicle::GetWheels() const
@@ -72,10 +69,7 @@ const Array<WheeledVehicle::Wheel>& WheeledVehicle::GetWheels() const
void WheeledVehicle::SetWheels(const Array<Wheel>& value)
{
_wheels = value;
if (IsDuringPlay())
{
Setup();
}
Setup();
}
WheeledVehicle::EngineSettings WheeledVehicle::GetEngine() const
@@ -235,7 +229,7 @@ void WheeledVehicle::GetWheelState(int32 index, WheelState& result)
void WheeledVehicle::Setup()
{
#if WITH_VEHICLE
if (!_actor)
if (!_actor || !IsDuringPlay())
return;
auto& drive = (PxVehicleWheels*&)_drive;

View File

@@ -372,9 +372,13 @@ public:
/// <param name="result">The current state.</param>
API_FUNCTION() void GetWheelState(int32 index, API_PARAM(Out) WheelState& result);
/// <summary>
/// Rebuilds the vehicle. Call it after modifying vehicle settings (eg. engine options).
/// </summary>
API_FUNCTION() void Setup();
private:
void Setup();
#if USE_EDITOR
void DrawPhysicsDebug(RenderView& view);
#endif