@@ -476,21 +476,14 @@ public virtual void LoadFromWagFile(string wagFilePath)
476476
477477 ( Vector3 mainMins , Vector3 mainMaxes ) = wagShape . GetBoundingLimits ( ) ;
478478
479- // Repeat for MSTS freight animation bounds
480- if ( ! string . IsNullOrEmpty ( FreightShapeFileName ) )
481- {
482- ShapeFile freightShape = new ShapeFile ( wagonFolderSlash + FreightShapeFileName , true ) ;
483-
484- ( Vector3 freightMins , Vector3 freightMaxes ) = freightShape . GetBoundingLimits ( ) ;
485-
486- // MSTS freight animations don't have offsets, so can be simply compared
487- mainMins = Vector3 . Min ( mainMins , freightMins ) ;
488- mainMaxes = Vector3 . Max ( mainMaxes , freightMaxes ) ;
489- }
479+ bool mstsFreightAnim = true ;
490480
491481 // And also repeat for ORTS freight animations
492482 if ( FreightAnimations != null )
493483 {
484+ if ( ! FreightAnimations . MSTSFreightAnimEnabled )
485+ mstsFreightAnim = false ;
486+
494487 foreach ( var freightAnim in FreightAnimations . Animations )
495488 {
496489 // We will ignore freight animations not attached to the main shape object for simplicity
@@ -528,6 +521,18 @@ public virtual void LoadFromWagFile(string wagFilePath)
528521 }
529522 }
530523
524+ // And also repeat for MSTS freight animation bounds (if enabled)
525+ if ( mstsFreightAnim && ! string . IsNullOrEmpty ( FreightShapeFileName ) )
526+ {
527+ ShapeFile freightShape = new ShapeFile ( wagonFolderSlash + FreightShapeFileName , true ) ;
528+
529+ ( Vector3 freightMins , Vector3 freightMaxes ) = freightShape . GetBoundingLimits ( ) ;
530+
531+ // MSTS freight animations don't have offsets, so can be simply compared
532+ mainMins = Vector3 . Min ( mainMins , freightMins ) ;
533+ mainMaxes = Vector3 . Max ( mainMaxes , freightMaxes ) ;
534+ }
535+
531536 // Set dimensions of wagon if configured as such
532537 if ( AutoSize )
533538 {
0 commit comments