@@ -709,52 +709,32 @@ private void UpdateAnimation(RenderFrame frame, ElapsedTime elapsedTime)
709
709
710
710
float distanceTravelledM = 0.0f ; // Distance travelled by non-driven wheels
711
711
float distanceTravelledDrivenM = 0.0f ; // Distance travelled by driven wheels
712
- float AnimationWheelRadiusM = 0.0f ; // Radius of non driven wheels
713
- float AnimationDriveWheelRadiusM = 0.0f ; // Radius of driven wheels
712
+ float AnimationWheelRadiusM = MSTSWagon . WheelRadiusM ; // Radius of non driven wheels
713
+ float AnimationDriveWheelRadiusM = MSTSWagon . DriverWheelRadiusM ; // Radius of driven wheels
714
714
715
715
if ( MSTSWagon . IsDriveable && MSTSWagon . Simulator . UseAdvancedAdhesion && ! MSTSWagon . Simulator . Settings . SimpleControlPhysics )
716
716
{
717
717
//TODO: next code line has been modified to flip trainset physics in order to get viewing direction coincident with loco direction when using rear cab.
718
718
// To achieve the same result with other means, without flipping trainset physics, the line should be changed as follows:
719
719
// distanceTravelledM = MSTSWagon.WheelSpeedMpS * elapsedTime.ClockSeconds;
720
720
721
- if ( Car . EngineType == Orts . Simulation . RollingStocks . TrainCar . EngineTypes . Steam ) // Steam locomotive so set up different speeds for different driver and non-driver wheels
721
+ distanceTravelledM = ( ( MSTSWagon . Train != null && MSTSWagon . Train . IsPlayerDriven && ( ( MSTSLocomotive ) MSTSWagon ) . UsingRearCab ) ? - 1 : 1 ) * MSTSWagon . WheelSpeedMpS * elapsedTime . ClockSeconds ;
722
+ if ( Car . EngineType == Orts . Simulation . RollingStocks . TrainCar . EngineTypes . Steam )
722
723
{
723
- distanceTravelledM = ( ( MSTSWagon . Train != null && MSTSWagon . Train . IsPlayerDriven && ( ( MSTSLocomotive ) MSTSWagon ) . UsingRearCab ) ? - 1 : 1 ) * MSTSWagon . WheelSpeedMpS * elapsedTime . ClockSeconds ;
724
724
distanceTravelledDrivenM = ( ( MSTSWagon . Train != null && MSTSWagon . Train . IsPlayerDriven && ( ( MSTSLocomotive ) MSTSWagon ) . UsingRearCab ) ? - 1 : 1 ) * MSTSWagon . WheelSpeedSlipMpS * elapsedTime . ClockSeconds ;
725
- // Set values of wheel radius - assume that drive wheel and non driven wheel are different sizes
726
- AnimationWheelRadiusM = MSTSWagon . WheelRadiusM ;
727
- AnimationDriveWheelRadiusM = MSTSWagon . DriverWheelRadiusM ;
728
725
}
729
- else // Other driveable rolling stock - all wheels have same speed .
726
+ else // Other driveable rolling stocked .
730
727
{
731
- distanceTravelledM = ( ( MSTSWagon . Train != null && MSTSWagon . Train . IsPlayerDriven && ( ( MSTSLocomotive ) MSTSWagon ) . UsingRearCab ) ? - 1 : 1 ) * MSTSWagon . WheelSpeedMpS * elapsedTime . ClockSeconds ;
732
728
distanceTravelledDrivenM = ( ( MSTSWagon . Train != null && MSTSWagon . Train . IsPlayerDriven && ( ( MSTSLocomotive ) MSTSWagon ) . UsingRearCab ) ? - 1 : 1 ) * MSTSWagon . WheelSpeedMpS * elapsedTime . ClockSeconds ;
733
- // Set values of wheel radius - assume that drive wheel and non driven wheel are same sizes
734
- AnimationWheelRadiusM = MSTSWagon . WheelRadiusM ;
735
- AnimationDriveWheelRadiusM = MSTSWagon . WheelRadiusM ;
736
729
}
737
730
}
738
731
else // set values for simple adhesion
739
732
{
740
-
741
733
distanceTravelledM = ( ( MSTSWagon . IsDriveable && MSTSWagon . Train != null && MSTSWagon . Train . IsPlayerDriven && ( ( MSTSLocomotive ) MSTSWagon ) . UsingRearCab ) ? - 1 : 1 ) * MSTSWagon . SpeedMpS * elapsedTime . ClockSeconds ;
742
- distanceTravelledDrivenM = ( ( MSTSWagon . IsDriveable && MSTSWagon . Train != null && MSTSWagon . Train . IsPlayerDriven && ( ( MSTSLocomotive ) MSTSWagon ) . UsingRearCab ) ? - 1 : 1 ) * MSTSWagon . SpeedMpS * elapsedTime . ClockSeconds ;
743
- // Set values of wheel radius - assume that drive wheel and non driven wheel are same sizes
744
- if ( Car . EngineType == Orts . Simulation . RollingStocks . TrainCar . EngineTypes . Steam ) // set values for steam stock
745
- {
746
- AnimationWheelRadiusM = MSTSWagon . WheelRadiusM ;
747
- AnimationDriveWheelRadiusM = MSTSWagon . DriverWheelRadiusM ;
748
- }
749
- else // set values for non-driveable stock, eg wagons, and driveable stock such as diesels, electric locomotives
750
- {
751
- AnimationWheelRadiusM = MSTSWagon . WheelRadiusM ;
752
- AnimationDriveWheelRadiusM = MSTSWagon . WheelRadiusM ;
753
- }
754
-
734
+ distanceTravelledDrivenM = distanceTravelledM ;
755
735
}
756
736
757
- if ( Car . BrakeSkid ) // if car wheels are skidding because of brakes lockin wheels up then stop wheels rotating.
737
+ if ( Car . BrakeSkid ) // if car wheels are skidding because of brakes locking wheels up then stop wheels rotating.
758
738
{
759
739
distanceTravelledM = 0.0f ;
760
740
distanceTravelledDrivenM = 0.0f ;
0 commit comments