Skip to content

Commit 5081138

Browse files
committed
Automatic merge of T1.6-rc3-30-gdf7bf1a26 and 9 pull requests
- Pull request #1104 at c039a26: Handle simple adhesion within the axle module - Pull request #1057 at 1c2bcb4: Switchable brake system - Pull request #1086 at e10390b: Add Settings Exporter tool (copy settings to INI, etc) - Pull request #1091 at 2391bc0: Automatic speed control - Pull request #1110 at 387388e: Fix Activity Runner persists after loading exception - Pull request #1115 at 270f22f: Do not activate ETS switch if no suitable cars are attached - Pull request #1121 at 80b81f4: Manually Override Articulation - Pull request #1082 at 5845a1a: Allow variable water level in glass gauge - Pull request #1081 at 689494b: Brake cuts power unification
11 parents f32458a + df7bf1a + c039a26 + 1c2bcb4 + e10390b + 2391bc0 + 387388e + 270f22f + 80b81f4 + 5845a1a + 689494b commit 5081138

File tree

3 files changed

+48
-13
lines changed

3 files changed

+48
-13
lines changed

Source/Documentation/Manual/features-rollingstock.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,35 @@ OR supports tilting trains. A train tilts when its .con file name contains the
403403

404404
.. image:: images/features-tilting.png
405405

406+
Advanced articulation control
407+
-----------------------------
408+
409+
A wide variety of modern rolling stock uses articulation, in which multiple rail vehicles
410+
share a single "Jacobs Bogie". Open Rails offers partial support for such passenger and
411+
freight units by allowing one wagon to include a bogie in its 3D model while the next
412+
wagon removes the bogie from its 3D model. Ideally, OR will then add an invisible bogie
413+
to the end of the wagon without the bogie to emulate "sharing" the bogie with the previous
414+
wagon.
415+
416+
However, this automatic system is limited. OR will check for wheels in the wagon's 3D
417+
model and will assume the wagon is articulated at one end if there are no wheels towards
418+
that end of the 3D model. This approach will only be used on 3D models with 3, 2, or 0 axles
419+
(the 1-axle case is excluded for compatibility reasons) and won't be used on locomotives.
420+
In some cases, this approach will result in false negative or false positive detection
421+
of articulation. Should the automatic articulation method not produce the expected track
422+
following behavior, it is now possible to manually define whether a wagon or engine
423+
should use the articulation behavior.
424+
425+
.. index::
426+
single: ORTSFrontArticulation
427+
single: ORTSRearArticulation
428+
429+
To forcibly enable the articulation behavior at the front of the rail vehicle, use
430+
``ORTSFrontArticulation ( 1 )`` and at the rear use ``ORTSRearArticulation ( 1 )``.
431+
Conversely, use ``ORTSFrontArticulation ( 0 )`` or ``ORTSRearArticulation ( 0 )`` to
432+
force disable articulation behavior. Entering a value of -1 provides the default
433+
automatic behavior.
434+
406435
Freight animations and pickups
407436
==============================
408437

Source/Orts.Simulation/Simulation/RollingStocks/MSTSWagon.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,8 @@ public virtual void Parse(string lowercasetoken, STFReader stf)
10331033
CarLengthM = stf.ReadFloat(STFReader.UNITS.Distance, null);
10341034
stf.SkipRestOfBlock();
10351035
break;
1036+
case "wagon(ortsfrontarticulation": FrontArticulation = stf.ReadIntBlock(null); break;
1037+
case "wagon(ortsreararticulation": RearArticulation = stf.ReadIntBlock(null); break;
10361038
case "wagon(ortslengthbogiecentre": CarBogieCentreLengthM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null); break;
10371039
case "wagon(ortslengthcarbody": CarBodyLengthM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null); break;
10381040
case "wagon(ortslengthairhose": CarAirHoseLengthM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null); break;

Source/Orts.Simulation/Simulation/RollingStocks/TrainCar.cs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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;
@@ -2723,34 +2725,36 @@ public void SetUpWheels()
27232725
// Decided to control what is sent to SetUpWheelsArticulation()by using
27242726
// WheelAxlesLoaded as a flag. This way, wagons that have to be processed are included
27252727
// and the rest left out.
2726-
bool articulatedFront = !WheelAxles.Any(a => a.OffsetM.Z < 0);
2727-
bool articulatedRear = !WheelAxles.Any(a => a.OffsetM.Z > 0);
2728-
var carIndex = Train.Cars.IndexOf(this);
2729-
//Certain locomotives are testing as articulated wagons for some reason.
2730-
if (WagonType != WagonTypes.Engine)
2731-
if (WheelAxles.Count != 1 && (articulatedFront || articulatedRear))
2728+
2729+
// Force articulation if stock is configured as such
2730+
// Otherwise, use default behavior which gives articulation if there are no axles forward/reareward on the mode,
2731+
// disables articulation on engines, and only allows articulation with 3 or fewer axles, but not 1 axle
2732+
bool articulatedFront = (FrontArticulation == 1 ||
2733+
(FrontArticulation == -1 && !WheelAxles.Any(a => a.OffsetM.Z < 0) && WagonType != WagonTypes.Engine && WheelAxles.Count != 1 && WheelAxles.Count <= 3));
2734+
bool articulatedRear = (RearArticulation == 1 ||
2735+
(RearArticulation == -1 && !WheelAxles.Any(a => a.OffsetM.Z > 0) && WagonType != WagonTypes.Engine && WheelAxles.Count != 1 && WheelAxles.Count <= 3));
2736+
2737+
if (articulatedFront || articulatedRear)
27322738
{
27332739
WheelAxlesLoaded = true;
2734-
SetUpWheelsArticulation(carIndex);
2740+
SetUpWheelsArticulation(articulatedFront, articulatedRear);
27352741
}
27362742
} // end SetUpWheels()
27372743

2738-
protected void SetUpWheelsArticulation(int carIndex)
2744+
protected void SetUpWheelsArticulation(bool front, bool rear)
27392745
{
27402746
// If there are no forward wheels, this car is articulated (joined
27412747
// to the car in front) at the front. Likewise for the rear.
2742-
bool articulatedFront = !WheelAxles.Any(a => a.OffsetM.Z < 0);
2743-
bool articulatedRear = !WheelAxles.Any(a => a.OffsetM.Z > 0);
27442748
// Original process originally used caused too many issues.
27452749
// The original process did include the below process of just using WheelAxles.Add
27462750
// if the initial test did not work. Since the below process is working without issues the
27472751
// original process was stripped down to what is below
2748-
if (articulatedFront || articulatedRear)
2752+
if (front || rear)
27492753
{
2750-
if (articulatedFront && WheelAxles.Count <= 3)
2754+
if (front)
27512755
WheelAxles.Add(new WheelAxle(new Vector3(0.0f, BogiePivotHeightM, -CarLengthM / 2.0f), 0, 0) { Part = Parts[0] });
27522756

2753-
if (articulatedRear && WheelAxles.Count <= 3)
2757+
if (rear)
27542758
WheelAxles.Add(new WheelAxle(new Vector3(0.0f, BogiePivotHeightM, CarLengthM / 2.0f), 0, 0) { Part = Parts[0] });
27552759

27562760
WheelAxles.Sort(WheelAxles[0]);

0 commit comments

Comments
 (0)