public void Execute()
 {
     float modelHeight = 1.8f;
     float modelWidth = .5f;
     float maxClimbSlope = 0.3f;
     float gridResolution = .25f;
     float maxDisjointDistance = .1f;  //.1f * oneMeter;
     int minimumFeatureSize = 3;    // 3 grid cells
     float terrainLevel = WorldEditor.Instance.GetTerrainHeight(modelObj.Position.x, modelObj.Position.z) - modelObj.Position.y;
     PathObjectType poType = new PathObjectType(modelObj.Name, modelHeight, modelWidth, maxClimbSlope,
                                                gridResolution, maxDisjointDistance, minimumFeatureSize);
     List<CollisionShape> shapes = WorldEditor.Instance.FindMeshCollisionShapes(modelObj.MeshName, modelObj.DisplayObject.Entity);
     PathGenerator pathGenerator = new PathGenerator(WorldEditor.Instance.LogPathGeneration, modelObj.Name, poType, terrainLevel,
                                                     modelObj.DisplayObject.SceneNode.FullTransform, shapes);
     // Perform traversal and creation of rectangles, arcs
     // between rectangles, and portals to the terrain
     pathGenerator.GeneratePolygonsArcsAndPortals();
 }
 public void AddModelPathObject(bool logPathGeneration, PathObjectType type, string modelName,
                                Vector3 modelPosition, Matrix4 modelTransform, 
                                List<CollisionShape> shapes, float terrainHeight)
 {
     PathGenerator pathGenerator = new PathGenerator(logPathGeneration, modelName, type, terrainHeight,
                                                     modelTransform, shapes);
     // Perform traversal and creation of polygons, arcs
     // between polygons, and portals to the terrain
     pathGenerator.GeneratePolygonsArcsAndPortals();
     List<PathPolygon> polygons = new List<PathPolygon>();
     List<PathArc> portals = new List<PathArc>();
     List<PathArc> arcs = new List<PathArc>();
     foreach(GridPolygon r in pathGenerator.CVPolygons)
         polygons.Add(new PathPolygon(r.Index, PolygonKind.CV, r.CornerLocs));
     foreach(GridPolygon r in pathGenerator.TerrainPolygons)
         polygons.Add(new PathPolygon(r.Index, PolygonKind.Terrain, r.CornerLocs));
     foreach(PolygonArc portal in pathGenerator.TerrainPortals)
         portals.Add(new PathArc(portal.Kind, portal.Poly1Index, portal.Poly2Index, MakePathEdge(portal.Edge)));
     foreach(PolygonArc arc in pathGenerator.PolygonArcs)
         arcs.Add(new PathArc(arc.Kind, arc.Poly1Index, arc.Poly2Index, MakePathEdge(arc.Edge)));
     pathObjects.Add(new PathObject(pathGenerator.ModelName, type.name, pathGenerator.FirstTerrainIndex,
                                    new PathPolygon(0, PolygonKind.Bounding, pathGenerator.ModelCorners),
             polygons, portals, arcs));
 }