@@ -187,6 +187,8 @@ public static Interpolator SteamHeatBoilerFuelUsageGalukpH()
187187 public float CarWidthM = 2.5f ;
188188 public float CarLengthM = 40 ; // derived classes must overwrite these defaults
189189 public float CarHeightM = 4 ; // derived classes must overwrite these defaults
190+ public int FrontArticulation = - 1 ; // -1: Determine front articulation automatically, 0: Force no front articulation, 1: Force front articulation
191+ public int RearArticulation = - 1 ; // -1: Determine rear articulation automatically, 0: Force no rear articulation, 1: Force rear articulation
190192 public float MassKG = 10000 ; // Mass in KG at runtime; coincides with InitialMassKG if there is no load and no ORTS freight anim
191193 public float InitialMassKG = 10000 ;
192194 public bool IsDriveable ;
@@ -2731,34 +2733,36 @@ public void SetUpWheels()
27312733 // Decided to control what is sent to SetUpWheelsArticulation()by using
27322734 // WheelAxlesLoaded as a flag. This way, wagons that have to be processed are included
27332735 // and the rest left out.
2734- bool articulatedFront = ! WheelAxles . Any ( a => a . OffsetM . Z < 0 ) ;
2735- bool articulatedRear = ! WheelAxles . Any ( a => a . OffsetM . Z > 0 ) ;
2736- var carIndex = Train . Cars . IndexOf ( this ) ;
2737- //Certain locomotives are testing as articulated wagons for some reason.
2738- if ( WagonType != WagonTypes . Engine )
2739- if ( WheelAxles . Count != 1 && ( articulatedFront || articulatedRear ) )
2740- {
2741- WheelAxlesLoaded = true ;
2742- SetUpWheelsArticulation ( carIndex ) ;
2743- }
2736+
2737+ // Force articulation if stock is configured as such
2738+ // Otherwise, use default behavior which gives articulation if there are no axles forward/reareward on the mode,
2739+ // disables articulation on engines, and only allows articulation with 3 or fewer axles, but not 1 axle
2740+ bool articulatedFront = ( FrontArticulation == 1 ||
2741+ ( FrontArticulation == - 1 && ! WheelAxles . Any ( a => a . OffsetM . Z < 0 ) && WagonType != WagonTypes . Engine && WheelAxles . Count != 1 && WheelAxles . Count <= 3 ) ) ;
2742+ bool articulatedRear = ( RearArticulation == 1 ||
2743+ ( RearArticulation == - 1 && ! WheelAxles . Any ( a => a . OffsetM . Z > 0 ) && WagonType != WagonTypes . Engine && WheelAxles . Count != 1 && WheelAxles . Count <= 3 ) ) ;
2744+
2745+ if ( articulatedFront || articulatedRear )
2746+ {
2747+ WheelAxlesLoaded = true ;
2748+ SetUpWheelsArticulation ( articulatedFront , articulatedRear ) ;
2749+ }
27442750 } // end SetUpWheels()
27452751
2746- protected void SetUpWheelsArticulation ( int carIndex )
2752+ protected void SetUpWheelsArticulation ( bool front , bool rear )
27472753 {
27482754 // If there are no forward wheels, this car is articulated (joined
27492755 // to the car in front) at the front. Likewise for the rear.
2750- bool articulatedFront = ! WheelAxles . Any ( a => a . OffsetM . Z < 0 ) ;
2751- bool articulatedRear = ! WheelAxles . Any ( a => a . OffsetM . Z > 0 ) ;
27522756 // Original process originally used caused too many issues.
27532757 // The original process did include the below process of just using WheelAxles.Add
27542758 // if the initial test did not work. Since the below process is working without issues the
27552759 // original process was stripped down to what is below
2756- if ( articulatedFront || articulatedRear )
2760+ if ( front || rear )
27572761 {
2758- if ( articulatedFront && WheelAxles . Count <= 3 )
2762+ if ( front )
27592763 WheelAxles . Add ( new WheelAxle ( new Vector3 ( 0.0f , BogiePivotHeightM , - CarLengthM / 2.0f ) , 0 , 0 ) { Part = Parts [ 0 ] } ) ;
27602764
2761- if ( articulatedRear && WheelAxles . Count <= 3 )
2765+ if ( rear )
27622766 WheelAxles . Add ( new WheelAxle ( new Vector3 ( 0.0f , BogiePivotHeightM , CarLengthM / 2.0f ) , 0 , 0 ) { Part = Parts [ 0 ] } ) ;
27632767
27642768 WheelAxles . Sort ( WheelAxles [ 0 ] ) ;
0 commit comments