You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Source/Orts.Simulation/Simulation/Physics/Train.cs
+46-11Lines changed: 46 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -1722,7 +1722,6 @@ public virtual void physicsUpdate(float elapsedClockSeconds)
1722
1722
massKg += car.MassKG;
1723
1723
//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.
1724
1724
// To achieve the same result with other means, without flipping trainset physics, the line should be changed as follows:
1725
-
// if (car.Flipped)
1726
1725
if (car.Flipped ^ (car.IsDriveable && car.Train.IsActualPlayerTrain && ((MSTSLocomotive)car).UsingRearCab))
1727
1726
{
1728
1727
car.TotalForceN = -car.TotalForceN;
@@ -5417,10 +5416,6 @@ public void UpdateCouplerSlack(float elapsedTime)
5417
5416
// update coupler slack distance
5418
5417
TrainCar car = Cars[i];
5419
5418
5420
-
// Initialise individual car coupler slack values
5421
-
car.RearCouplerSlackM = 0;
5422
-
car.FrontCouplerSlackM = 0;
5423
-
5424
5419
// Calculate coupler slack - this should be the full amount for both couplers
// Check to see if coupler is opened or closed - only closed or opened couplers have been specified
5454
-
// It is assumed that the front coupler on first car will always be opened, and so will coupler on last car. All others on the train will be coupled
5455
-
if (i == 0)
5449
+
// It is assumed that the front coupler on first car will always be opened, and so will the coupler on last car. All others on the train will be coupled
5450
+
if (i == 0) // first car
5456
5451
{
5457
5452
if (car.FrontCouplerOpenFitted)
5458
5453
{
@@ -5469,8 +5464,8 @@ public void UpdateCouplerSlack(float elapsedTime)
5469
5464
car.FrontCouplerOpen = false;
5470
5465
}
5471
5466
5472
-
5473
-
if (i == Cars.Count - 2)
5467
+
// Set up coupler information for last car
5468
+
if (i == Cars.Count - 2) // 2nd last car in count, but set up last car, ie i+1
5474
5469
{
5475
5470
5476
5471
if (Cars[i + 1].RearCouplerOpenFitted)
@@ -5549,8 +5544,48 @@ public void UpdateCouplerSlack(float elapsedTime)
0 commit comments