Allow GetVehiclePhysicsControl to succeed when physics is off

This commit is contained in:
Andrew Patrikalakis 2024-03-10 14:31:05 -04:00 committed by Blyron
parent d7228f7467
commit fda970b881
1 changed files with 34 additions and 20 deletions

View File

@ -459,17 +459,25 @@ FVehiclePhysicsControl ACarlaWheeledVehicle::GetVehiclePhysicsControl() const
{
FWheelPhysicsControl PhysicsWheel;
PxVehicleWheelData PWheelData = Vehicle4W->PVehicle->mWheelsSimData.getWheelData(i);
PhysicsWheel.DampingRate = Cm2ToM2(PWheelData.mDampingRate);
PhysicsWheel.MaxSteerAngle = FMath::RadiansToDegrees(PWheelData.mMaxSteer);
PhysicsWheel.Radius = PWheelData.mRadius;
PhysicsWheel.MaxBrakeTorque = Cm2ToM2(PWheelData.mMaxBrakeTorque);
PhysicsWheel.MaxHandBrakeTorque = Cm2ToM2(PWheelData.mMaxHandBrakeTorque);
if (bPhysicsEnabled) {
PxVehicleWheelData PWheelData = Vehicle4W->PVehicle->mWheelsSimData.getWheelData(i);
PxVehicleTireData PTireData = Vehicle4W->PVehicle->mWheelsSimData.getTireData(i);
PhysicsWheel.LatStiffMaxLoad = PTireData.mLatStiffX;
PhysicsWheel.LatStiffValue = PTireData.mLatStiffY;
PhysicsWheel.LongStiffValue = PTireData.mLongitudinalStiffnessPerUnitGravity;
PhysicsWheel.DampingRate = Cm2ToM2(PWheelData.mDampingRate);
PhysicsWheel.MaxSteerAngle = FMath::RadiansToDegrees(PWheelData.mMaxSteer);
PhysicsWheel.Radius = PWheelData.mRadius;
PhysicsWheel.MaxBrakeTorque = Cm2ToM2(PWheelData.mMaxBrakeTorque);
PhysicsWheel.MaxHandBrakeTorque = Cm2ToM2(PWheelData.mMaxHandBrakeTorque);
PxVehicleTireData PTireData = Vehicle4W->PVehicle->mWheelsSimData.getTireData(i);
PhysicsWheel.LatStiffMaxLoad = PTireData.mLatStiffX;
PhysicsWheel.LatStiffValue = PTireData.mLatStiffY;
PhysicsWheel.LongStiffValue = PTireData.mLongitudinalStiffnessPerUnitGravity;
} else {
if (i < LastPhysicsControl.Wheels.Num()) {
PhysicsWheel = LastPhysicsControl.Wheels[i];
}
}
PhysicsWheel.TireFriction = Vehicle4W->Wheels[i]->TireConfig->GetFrictionScale();
PhysicsWheel.Position = Vehicle4W->Wheels[i]->Location;
@ -537,17 +545,23 @@ FVehiclePhysicsControl ACarlaWheeledVehicle::GetVehiclePhysicsControl() const
{
FWheelPhysicsControl PhysicsWheel;
PxVehicleWheelData PWheelData = VehicleNW->PVehicle->mWheelsSimData.getWheelData(i);
PhysicsWheel.DampingRate = Cm2ToM2(PWheelData.mDampingRate);
PhysicsWheel.MaxSteerAngle = FMath::RadiansToDegrees(PWheelData.mMaxSteer);
PhysicsWheel.Radius = PWheelData.mRadius;
PhysicsWheel.MaxBrakeTorque = Cm2ToM2(PWheelData.mMaxBrakeTorque);
PhysicsWheel.MaxHandBrakeTorque = Cm2ToM2(PWheelData.mMaxHandBrakeTorque);
if (bPhysicsEnabled) {
PxVehicleWheelData PWheelData = VehicleNW->PVehicle->mWheelsSimData.getWheelData(i);
PhysicsWheel.DampingRate = Cm2ToM2(PWheelData.mDampingRate);
PhysicsWheel.MaxSteerAngle = FMath::RadiansToDegrees(PWheelData.mMaxSteer);
PhysicsWheel.Radius = PWheelData.mRadius;
PhysicsWheel.MaxBrakeTorque = Cm2ToM2(PWheelData.mMaxBrakeTorque);
PhysicsWheel.MaxHandBrakeTorque = Cm2ToM2(PWheelData.mMaxHandBrakeTorque);
PxVehicleTireData PTireData = VehicleNW->PVehicle->mWheelsSimData.getTireData(i);
PhysicsWheel.LatStiffMaxLoad = PTireData.mLatStiffX;
PhysicsWheel.LatStiffValue = PTireData.mLatStiffY;
PhysicsWheel.LongStiffValue = PTireData.mLongitudinalStiffnessPerUnitGravity;
PxVehicleTireData PTireData = VehicleNW->PVehicle->mWheelsSimData.getTireData(i);
PhysicsWheel.LatStiffMaxLoad = PTireData.mLatStiffX;
PhysicsWheel.LatStiffValue = PTireData.mLatStiffY;
PhysicsWheel.LongStiffValue = PTireData.mLongitudinalStiffnessPerUnitGravity;
} else {
if (i < LastPhysicsControl.Wheels.Num()) {
PhysicsWheel = LastPhysicsControl.Wheels[i];
}
}
PhysicsWheel.TireFriction = VehicleNW->Wheels[i]->TireConfig->GetFrictionScale();
PhysicsWheel.Position = VehicleNW->Wheels[i]->Location;