I want to change the tire config on a single vehicle instance at runtime, however I’m unable to do that.
This is what I’m doing:
if (UWheeledVehicleMovementComponent* WheeledMovement = AffectedVehicle->WheeledMoveComp)
{
PRAGMA_DISABLE_DEPRECATION_WARNINGS
UTireConfig* TireConfig = NewObject<UTireConfig>(this);
TireConfig->SetFrictionScale(0.0f);
PxVehicleWheels* PVehicle = WheeledMovement->PVehicle;
OriginalTireConfigs.Empty();
for (UVehicleWheel* Wheel : WheeledMovement->Wheels)
{
OriginalTireConfigs.Add(Wheel->TireConfig);
Wheel->TireConfig = TireConfig;
PxVehicleTireData PTireData;
PTireData.mType = TireConfig->GetTireConfigID();
PTireData.mLatStiffX = Wheel->LatStiffMaxLoad;
PTireData.mLatStiffY = Wheel->LatStiffValue;
PTireData.mLongitudinalStiffnessPerUnitGravity = Wheel->LongStiffValue;
PVehicle->mWheelsSimData.setTireData(Wheel->WheelIndex, PTireData);
}
PRAGMA_ENABLE_DEPRECATION_WARNINGS
}
If I’m not creating a new tire config object and instead use a tire config asset, the result is the same.
Increasing the friction scale slightly also doesn’t work.
I know about this thread:
[Content removed]