@@ -1030,22 +1030,22 @@ private void UpdateCouplers(RenderFrame frame, ElapsedTime elapsedTime)
10301030 // Display front airhose in sim if open coupler shape is configured, otherwise skip to next section, and just display closed (default) coupler if configured
10311031 if ( FrontAirHoseShape != null && ! ( Viewer . Camera . AttachedCar == this . MSTSWagon && Viewer . Camera . Style == Camera . Styles . ThreeDimCab ) )
10321032 {
1033- // Get the movement that would be needed to locate the coupler on the car if they were pointing in the default direction.
1034- var displacement = new Vector3
1035- {
1036- X = Car . FrontAirHoseAnimWidthM ,
1037- Y = Car . FrontAirHoseAnimHeightM ,
1038- Z = ( Car . FrontAirHoseAnimLengthM + ( Car . CarLengthM / 2.0f ) ) // Reversed as this is the rear coupler of the wagon
1039- } ;
10401033
10411034 if ( Car . CarAhead != null ) // Display animated coupler if there is a car behind this car
10421035 {
1036+ // Get the movement that would be needed to locate the air hose on the car if they were pointing in the default direction.
1037+ var displacement = new Vector3
1038+ {
1039+ X = Car . FrontAirHoseAnimWidthM ,
1040+ Y = Car . FrontAirHoseAnimHeightM + Car . FrontAirHoseHeightAdjustmentM ,
1041+ Z = ( Car . FrontCouplerAnimLengthM + ( Car . CarLengthM / 2.0f ) + Car . FrontCouplerSlackM )
1042+ } ;
1043+
10431044 var quaternion = PositionCoupler ( Car , FrontAirHoseShape , displacement ) ;
10441045
10451046 var quaternionCar = new Quaternion ( quaternion . X , quaternion . Y , quaternion . Z , quaternion . W ) ;
10461047
1047- var maximumCouplerExtension = Me . FromIn ( 3.0f ) ;
1048- var AirHoseAngleRadians = ( Car . CouplerSlackM / maximumCouplerExtension ) * 0.174533f ;
1048+ var AirHoseAngleRadians = Car . FrontAirHoseAngleAdjustmentRad ;
10491049
10501050 AlignCouplerWithCar ( Car , FrontAirHoseShape ) ;
10511051
@@ -1057,6 +1057,14 @@ private void UpdateCouplers(RenderFrame frame, ElapsedTime elapsedTime)
10571057 }
10581058 else if ( FrontAirHoseDisconnectedShape != null && Car . RearCouplerOpenFitted && Car . RearCouplerOpen ) // Display open coupler if no car is behind car, and an open coupler shape is present
10591059 {
1060+ // Get the movement that would be needed to locate the air hose on the car if they were pointing in the default direction.
1061+ var displacement = new Vector3
1062+ {
1063+ X = Car . FrontAirHoseAnimWidthM ,
1064+ Y = Car . FrontAirHoseAnimHeightM ,
1065+ Z = ( Car . FrontCouplerAnimLengthM + ( Car . CarLengthM / 2.0f ) + Car . FrontCouplerSlackM )
1066+ } ;
1067+
10601068 var quaternion = PositionCoupler ( Car , FrontAirHoseDisconnectedShape , displacement ) ;
10611069
10621070 AlignCouplerWithCar ( Car , FrontAirHoseDisconnectedShape ) ;
@@ -1066,6 +1074,13 @@ private void UpdateCouplers(RenderFrame frame, ElapsedTime elapsedTime)
10661074 }
10671075 else //Display closed static coupler by default if other conditions not met
10681076 {
1077+ // Get the movement that would be needed to locate the air hose on the car if they were pointing in the default direction.
1078+ var displacement = new Vector3
1079+ {
1080+ X = Car . FrontAirHoseAnimWidthM ,
1081+ Y = Car . FrontAirHoseAnimHeightM ,
1082+ Z = ( Car . FrontCouplerAnimLengthM + ( Car . CarLengthM / 2.0f ) + Car . FrontCouplerSlackM )
1083+ } ;
10691084 var quaternion = PositionCoupler ( Car , FrontAirHoseShape , displacement ) ;
10701085
10711086 AlignCouplerWithCar ( Car , FrontAirHoseShape ) ;
@@ -1079,22 +1094,22 @@ private void UpdateCouplers(RenderFrame frame, ElapsedTime elapsedTime)
10791094 // Display rear airhose in sim if open coupler shape is configured, otherwise skip to next section, and just display closed (default) coupler if configured
10801095 if ( RearAirHoseShape != null && ! ( Viewer . Camera . AttachedCar == this . MSTSWagon && Viewer . Camera . Style == Camera . Styles . ThreeDimCab ) )
10811096 {
1082- // Get the movement that would be needed to locate the coupler on the car if they were pointing in the default direction.
1083- var displacement = new Vector3
1084- {
1085- X = Car . RearAirHoseAnimWidthM ,
1086- Y = Car . RearAirHoseAnimHeightM ,
1087- Z = - ( Car . RearAirHoseAnimLengthM + ( Car . CarLengthM / 2.0f ) ) // Reversed as this is the rear coupler of the wagon
1088- } ;
10891097
1090- if ( Car . CarBehind != null ) // Display animated coupler if there is a car behind this car
1098+ if ( Car . CarBehind != null ) // Display animated air hose if there is a car behind this car
10911099 {
1100+ // Get the movement that would be needed to locate the air hose on the car if they were pointing in the default direction.
1101+ var displacement = new Vector3
1102+ {
1103+ X = Car . RearAirHoseAnimWidthM ,
1104+ Y = Car . RearAirHoseAnimHeightM + Car . RearAirHoseHeightAdjustmentM ,
1105+ Z = - ( Car . RearCouplerAnimLengthM + ( Car . CarLengthM / 2.0f ) + Car . RearCouplerSlackM ) // Reversed as this is the rear coupler of the wagon
1106+ } ;
1107+
10921108 var quaternion = PositionCoupler ( Car , RearAirHoseShape , displacement ) ;
10931109
10941110 var quaternionCar = new Quaternion ( quaternion . X , quaternion . Y , quaternion . Z , quaternion . W ) ;
10951111
1096- var maximumCouplerExtension = Me . FromIn ( 3.0f ) ;
1097- var AirHoseAngleRadians = - ( Car . CouplerSlackM / maximumCouplerExtension ) * 0.174533f ;
1112+ var AirHoseAngleRadians = - Car . RearAirHoseAngleAdjustmentRad ;
10981113
10991114 AlignCouplerWithCar ( Car , RearAirHoseShape ) ;
11001115
@@ -1104,17 +1119,33 @@ private void UpdateCouplers(RenderFrame frame, ElapsedTime elapsedTime)
11041119 RearAirHoseShape . PrepareFrame ( frame , elapsedTime ) ;
11051120
11061121 }
1107- else if ( RearAirHoseDisconnectedShape != null && Car . RearCouplerOpenFitted && Car . RearCouplerOpen ) // Display open coupler if no car is behind car, and an open coupler shape is present
1122+ else if ( RearAirHoseDisconnectedShape != null && Car . RearCouplerOpenFitted && Car . RearCouplerOpen ) // Display single air hose if no car is behind car, and an open air hose shape is present
11081123 {
1124+ // Get the movement that would be needed to locate the air hose on the car if they were pointing in the default direction.
1125+ var displacement = new Vector3
1126+ {
1127+ X = Car . RearAirHoseAnimWidthM ,
1128+ Y = Car . RearAirHoseAnimHeightM ,
1129+ Z = - ( Car . RearCouplerAnimLengthM + ( Car . CarLengthM / 2.0f ) + Car . RearCouplerSlackM ) // Reversed as this is the rear coupler of the wagon
1130+ } ;
1131+
11091132 var quaternion = PositionCoupler ( Car , RearAirHoseDisconnectedShape , displacement ) ;
11101133
11111134 AlignCouplerWithCar ( Car , RearAirHoseDisconnectedShape ) ;
11121135
11131136 // Display Animation Shape
11141137 RearAirHoseDisconnectedShape . PrepareFrame ( frame , elapsedTime ) ;
11151138 }
1116- else //Display closed static coupler by default if other conditions not met
1139+ else //Display closed static air hose by default if other conditions not met
11171140 {
1141+ // Get the movement that would be needed to locate the air hose on the car if they were pointing in the default direction.
1142+ var displacement = new Vector3
1143+ {
1144+ X = Car . RearAirHoseAnimWidthM ,
1145+ Y = Car . RearAirHoseAnimHeightM ,
1146+ Z = - ( Car . RearCouplerAnimLengthM + ( Car . CarLengthM / 2.0f ) + Car . RearCouplerSlackM ) // Reversed as this is the rear coupler of the wagon
1147+ } ;
1148+
11181149 var quaternion = PositionCoupler ( Car , RearAirHoseShape , displacement ) ;
11191150
11201151 AlignCouplerWithCar ( Car , RearAirHoseShape ) ;
0 commit comments