@@ -61,23 +61,35 @@ public static bool DecomposeStaticSuperElevation(Viewer viewer, TrackObj trackOb
61
61
62
62
TrackShape shape ;
63
63
64
+ bool dontRender = false ; // Should this shape be left as a static object?
65
+ SectionIdx [ ] SectionIdxs ;
66
+
64
67
try
65
68
{
66
69
shape = viewer . Simulator . TSectionDat . TrackShapes . Get ( trackObj . SectionIdx ) ;
67
70
68
- if ( shape . RoadShape == true )
71
+ if ( shape . RoadShape )
69
72
return false ; // Roads don't use superelevation, no use in processing them.
73
+
74
+ // Can't render superelevation on tunnel shapes
75
+ dontRender = shape . TunnelShape ;
76
+ SectionIdxs = shape . SectionIdxs ;
70
77
}
71
78
catch ( Exception )
72
79
{
73
- return false ; // Won't be able to render with superelevation
80
+ // Some route-specific shapes (DynaTrax) won't be populated in the TrackShapes list, check the TrackPaths list
81
+ if ( viewer . Simulator . TSectionDat . TSectionIdx . TrackPaths . TryGetValue ( trackObj . SectionIdx , out TrackPath path ) )
82
+ {
83
+ // Translate given data into a SectionIdx object that the rest of the method can interpret
84
+ // Assumptions: Each piece of DynaTrax is a single section with origin 0, 0, 0 and 0 angle,
85
+ // and the entire section of DynaTrax is defined by the track sections given in the track path
86
+ SectionIdxs = new SectionIdx [ 1 ] ;
87
+ SectionIdxs [ 0 ] = new SectionIdx ( path ) ;
88
+ }
89
+ else
90
+ return false ; // Not enough info, won't be able to render with superelevation
74
91
}
75
92
76
- SectionIdx [ ] SectionIdxs = shape . SectionIdxs ;
77
-
78
- // Can't render superelevation on tunnel shapes
79
- // NOTE: Even if we don't render superelevation, we still need to run through processing to remove superelevation from track sections
80
- bool dontRender = shape . TunnelShape ;
81
93
// Sometimes junctions get caught here, physics superelevation should be removed for those as well
82
94
bool removePhys = false ;
83
95
// 0 = centered, positive = rotation axis moves to inside of curve, negative = moves to outside of curve
0 commit comments