@@ -1030,22 +1030,22 @@ private void UpdateCouplers(RenderFrame frame, ElapsedTime elapsedTime)
1030
1030
// Display front airhose in sim if open coupler shape is configured, otherwise skip to next section, and just display closed (default) coupler if configured
1031
1031
if ( FrontAirHoseShape != null && ! ( Viewer . Camera . AttachedCar == this . MSTSWagon && Viewer . Camera . Style == Camera . Styles . ThreeDimCab ) )
1032
1032
{
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
- } ;
1040
1033
1041
1034
if ( Car . CarAhead != null ) // Display animated coupler if there is a car behind this car
1042
1035
{
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
+
1043
1044
var quaternion = PositionCoupler ( Car , FrontAirHoseShape , displacement ) ;
1044
1045
1045
1046
var quaternionCar = new Quaternion ( quaternion . X , quaternion . Y , quaternion . Z , quaternion . W ) ;
1046
1047
1047
- var maximumCouplerExtension = Me . FromIn ( 3.0f ) ;
1048
- var AirHoseAngleRadians = ( Car . CouplerSlackM / maximumCouplerExtension ) * 0.174533f ;
1048
+ var AirHoseAngleRadians = Car . FrontAirHoseAngleAdjustmentRad ;
1049
1049
1050
1050
AlignCouplerWithCar ( Car , FrontAirHoseShape ) ;
1051
1051
@@ -1057,6 +1057,14 @@ private void UpdateCouplers(RenderFrame frame, ElapsedTime elapsedTime)
1057
1057
}
1058
1058
else if ( FrontAirHoseDisconnectedShape != null && Car . RearCouplerOpenFitted && Car . RearCouplerOpen ) // Display open coupler if no car is behind car, and an open coupler shape is present
1059
1059
{
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
+
1060
1068
var quaternion = PositionCoupler ( Car , FrontAirHoseDisconnectedShape , displacement ) ;
1061
1069
1062
1070
AlignCouplerWithCar ( Car , FrontAirHoseDisconnectedShape ) ;
@@ -1066,6 +1074,13 @@ private void UpdateCouplers(RenderFrame frame, ElapsedTime elapsedTime)
1066
1074
}
1067
1075
else //Display closed static coupler by default if other conditions not met
1068
1076
{
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
+ } ;
1069
1084
var quaternion = PositionCoupler ( Car , FrontAirHoseShape , displacement ) ;
1070
1085
1071
1086
AlignCouplerWithCar ( Car , FrontAirHoseShape ) ;
@@ -1079,22 +1094,22 @@ private void UpdateCouplers(RenderFrame frame, ElapsedTime elapsedTime)
1079
1094
// Display rear airhose in sim if open coupler shape is configured, otherwise skip to next section, and just display closed (default) coupler if configured
1080
1095
if ( RearAirHoseShape != null && ! ( Viewer . Camera . AttachedCar == this . MSTSWagon && Viewer . Camera . Style == Camera . Styles . ThreeDimCab ) )
1081
1096
{
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
- } ;
1089
1097
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
1091
1099
{
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
+
1092
1108
var quaternion = PositionCoupler ( Car , RearAirHoseShape , displacement ) ;
1093
1109
1094
1110
var quaternionCar = new Quaternion ( quaternion . X , quaternion . Y , quaternion . Z , quaternion . W ) ;
1095
1111
1096
- var maximumCouplerExtension = Me . FromIn ( 3.0f ) ;
1097
- var AirHoseAngleRadians = - ( Car . CouplerSlackM / maximumCouplerExtension ) * 0.174533f ;
1112
+ var AirHoseAngleRadians = - Car . RearAirHoseAngleAdjustmentRad ;
1098
1113
1099
1114
AlignCouplerWithCar ( Car , RearAirHoseShape ) ;
1100
1115
@@ -1104,17 +1119,33 @@ private void UpdateCouplers(RenderFrame frame, ElapsedTime elapsedTime)
1104
1119
RearAirHoseShape . PrepareFrame ( frame , elapsedTime ) ;
1105
1120
1106
1121
}
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
1108
1123
{
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
+
1109
1132
var quaternion = PositionCoupler ( Car , RearAirHoseDisconnectedShape , displacement ) ;
1110
1133
1111
1134
AlignCouplerWithCar ( Car , RearAirHoseDisconnectedShape ) ;
1112
1135
1113
1136
// Display Animation Shape
1114
1137
RearAirHoseDisconnectedShape . PrepareFrame ( frame , elapsedTime ) ;
1115
1138
}
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
1117
1140
{
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
+
1118
1149
var quaternion = PositionCoupler ( Car , RearAirHoseShape , displacement ) ;
1119
1150
1120
1151
AlignCouplerWithCar ( Car , RearAirHoseShape ) ;
0 commit comments