@@ -460,21 +460,14 @@ public virtual void LoadFromWagFile(string wagFilePath)
460460
461461 ( Vector3 mainMins , Vector3 mainMaxes ) = wagShape . GetBoundingLimits ( ) ;
462462
463- // Repeat for MSTS freight animation bounds
464- if ( ! string . IsNullOrEmpty ( FreightShapeFileName ) )
465- {
466- ShapeFile freightShape = new ShapeFile ( wagonFolderSlash + FreightShapeFileName , true ) ;
467-
468- ( Vector3 freightMins , Vector3 freightMaxes ) = freightShape . GetBoundingLimits ( ) ;
469-
470- // MSTS freight animations don't have offsets, so can be simply compared
471- mainMins = Vector3 . Min ( mainMins , freightMins ) ;
472- mainMaxes = Vector3 . Max ( mainMaxes , freightMaxes ) ;
473- }
463+ bool mstsFreightAnim = true ;
474464
475465 // And also repeat for ORTS freight animations
476466 if ( FreightAnimations != null )
477467 {
468+ if ( ! FreightAnimations . MSTSFreightAnimEnabled )
469+ mstsFreightAnim = false ;
470+
478471 foreach ( var freightAnim in FreightAnimations . Animations )
479472 {
480473 // We will ignore freight animations not attached to the main shape object for simplicity
@@ -512,6 +505,18 @@ public virtual void LoadFromWagFile(string wagFilePath)
512505 }
513506 }
514507
508+ // And also repeat for MSTS freight animation bounds (if enabled)
509+ if ( mstsFreightAnim && ! string . IsNullOrEmpty ( FreightShapeFileName ) )
510+ {
511+ ShapeFile freightShape = new ShapeFile ( wagonFolderSlash + FreightShapeFileName , true ) ;
512+
513+ ( Vector3 freightMins , Vector3 freightMaxes ) = freightShape . GetBoundingLimits ( ) ;
514+
515+ // MSTS freight animations don't have offsets, so can be simply compared
516+ mainMins = Vector3 . Min ( mainMins , freightMins ) ;
517+ mainMaxes = Vector3 . Max ( mainMaxes , freightMaxes ) ;
518+ }
519+
515520 // Set dimensions of wagon if configured as such
516521 if ( AutoSize )
517522 {
0 commit comments