@@ -345,19 +345,16 @@ public WorldFile(Viewer viewer, int tileX, int tileZ, bool visible)
345345 if ( shapeFilePath != null )
346346 {
347347 var shape = new ShapeDescriptorFile ( shapeDescriptorPath ) ;
348- if ( shape != null )
348+ if ( shape . shape ? . ESD_Bounding_Box != null )
349349 {
350- if ( shape . shape . ESD_Bounding_Box != null )
351- {
352- var min = shape . shape . ESD_Bounding_Box . Min ;
353- var max = shape . shape . ESD_Bounding_Box . Max ;
354- var transform = Matrix . Invert ( worldMatrix . XNAMatrix ) ;
355- // Not sure if this is needed, but it is to correct for center-of-gravity being not the center of the box.
356- //transform.M41 += (max.X + min.X) / 2;
357- //transform.M42 += (max.Y + min.Y) / 2;
358- //transform.M43 += (max.Z + min.Z) / 2;
359- BoundingBoxes . Add ( new BoundingBox ( transform , new Vector3 ( ( max . X - min . X ) / 2 , ( max . Y - min . Y ) / 2 , ( max . Z - min . Z ) / 2 ) , worldMatrix . XNAMatrix . Translation . Y ) ) ;
360- }
350+ var min = shape . shape . ESD_Bounding_Box . Min ;
351+ var max = shape . shape . ESD_Bounding_Box . Max ;
352+ var transform = Matrix . Invert ( worldMatrix . XNAMatrix ) ;
353+ // Not sure if this is needed, but it is to correct for center-of-gravity being not the center of the box.
354+ //transform.M41 += (max.X + min.X) / 2;
355+ //transform.M42 += (max.Y + min.Y) / 2;
356+ //transform.M43 += (max.Z + min.Z) / 2;
357+ BoundingBoxes . Add ( new BoundingBox ( transform , new Vector3 ( ( max . X - min . X ) / 2 , ( max . Y - min . Y ) / 2 , ( max . Z - min . Z ) / 2 ) , worldMatrix . XNAMatrix . Translation . Y ) ) ;
361358 }
362359 }
363360
0 commit comments