Skip to content

Commit 86d38a2

Browse files
committed
Hide NaNs
1 parent 0017b1a commit 86d38a2

File tree

1 file changed

+3
-0
lines changed
  • Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerTransmissions

1 file changed

+3
-0
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerTransmissions/Axle.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,9 @@ void Integrate(float elapsedClockSeconds)
13051305
/// <param name="elapsedSeconds"></param>
13061306
public virtual void Update(float elapsedSeconds)
13071307
{
1308+
if (float.IsNaN(TrainSpeedMpS)) TrainSpeedMpS = 0;
1309+
if (double.IsNaN(AxleSpeedMpS)) AxleSpeedMpS = 0;
1310+
13081311
bool advancedAdhesion = Car is MSTSLocomotive locomotive && locomotive.AdvancedAdhesionModel;
13091312
advancedAdhesion &= DriveType != AxleDriveType.NotDriven; // Skip integrator for undriven axles to save CPU
13101313
forceToAccelerationFactor = WheelRadiusM * WheelRadiusM / totalInertiaKgm2;

0 commit comments

Comments
 (0)