Skip to content

Commit

Permalink
Fix wheels not rotating in AI modes
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarBLG committed Aug 2, 2023
1 parent 2f57132 commit bbaeeba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -2018,6 +2018,7 @@ public override void Update(float elapsedClockSeconds)

AntiSlip = true; // Always set AI trains to AntiSlip
SimpleAdhesion(); // Simple adhesion model used for AI trains
AdvancedAdhesionModel = false;
if (Train.IsActualPlayerTrain) FilteredMotiveForceN = CurrentFilter.Filter(MotiveForceN, elapsedClockSeconds);
WheelSpeedMpS = Flipped ? -AbsSpeedMpS : AbsSpeedMpS; //make the wheels go round
break;
Expand Down
3 changes: 1 addition & 2 deletions Source/RunActivity/Viewer3D/RollingStock/MSTSWagonViewer.cs
Expand Up @@ -726,9 +726,8 @@ private void UpdateAnimation(RenderFrame frame, ElapsedTime elapsedTime)
float AnimationWheelRadiusM = MSTSWagon.WheelRadiusM; // Radius of non driven wheels
float AnimationDriveWheelRadiusM = MSTSWagon.DriverWheelRadiusM; // Radius of driven wheels

if (MSTSWagon.IsDriveable && MSTSWagon.Simulator.UseAdvancedAdhesion && !MSTSWagon.Simulator.Settings.SimpleControlPhysics)
if (MSTSWagon is MSTSLocomotive loco && loco.AdvancedAdhesionModel)
{
var loco = MSTSWagon as MSTSLocomotive;
//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.
// To achieve the same result with other means, without flipping trainset physics, the line should be changed as follows:
// distanceTravelledM = MSTSWagon.WheelSpeedMpS * elapsedTime.ClockSeconds;
Expand Down

0 comments on commit bbaeeba

Please sign in to comment.