File tree 1 file changed +17
-4
lines changed
Source/Orts.Simulation/Simulation/RollingStocks
1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -3503,13 +3503,26 @@ private void UpdateFX(float elapsedClockSeconds)
3503
3503
// Variable is proportional to angular speed, value of 10 means 1 rotation/second.
3504
3504
// If wheel is not slipping then use normal wheel speed, this reduces oscillations in variable1 which causes issues with sounds.
3505
3505
3506
- if (SteamEngines[i].AttachedAxle.IsWheelSlip )
3506
+ if (((Train.TrainType == Train.TRAINTYPE.PLAYER && !Train.Autopilot) || Train.TrainType == Train.TRAINTYPE.AI_PLAYERDRIVEN) && (Simulator.UseAdvancedAdhesion && !Simulator.Settings.SimpleControlPhysics) )
3507
3507
{
3508
- variable[i] = Math.Abs(SteamEngines[i].AttachedAxle.SlipSpeedMpS / SteamEngines[i].AttachedAxle.WheelRadiusM / MathHelper.Pi * 5);
3508
+ if (SteamEngines[i].AttachedAxle.IsWheelSlip)
3509
+ {
3510
+ variable[i] = Math.Abs(SteamEngines[i].AttachedAxle.SlipSpeedMpS / SteamEngines[i].AttachedAxle.WheelRadiusM / MathHelper.Pi * 5);
3511
+ }
3512
+ else
3513
+ {
3514
+ variable[i] = Math.Abs((float)SteamEngines[i].AttachedAxle.AxleSpeedMpS / SteamEngines[i].AttachedAxle.WheelRadiusM / MathHelper.Pi * 5);
3515
+ }
3509
3516
}
3510
- else
3517
+ else
3518
+ // Axle code is not executed if it is an AI train, on Autopilot, or Simple adhesion or simple physics is selected. Hence must use wheelspeed in these instances
3511
3519
{
3512
- variable[i] = Math.Abs((float)SteamEngines[i].AttachedAxle.AxleSpeedMpS / SteamEngines[i].AttachedAxle.WheelRadiusM / MathHelper.Pi * 5);
3520
+ if (WheelSlip)
3521
+ variable[i] = Math.Abs(WheelSpeedSlipMpS / SteamEngines[0].AttachedAxle.WheelRadiusM / MathHelper.Pi * 5);
3522
+ else
3523
+ {
3524
+ variable[i] = Math.Abs(WheelSpeedMpS / SteamEngines[0].AttachedAxle.WheelRadiusM / MathHelper.Pi * 5);
3525
+ }
3513
3526
}
3514
3527
3515
3528
variable[i] = ThrottlePercent == 0 ? 0 : variable[i];
You can’t perform that action at this time.
0 commit comments