Example #1
0
    public static void InitCylinder()
    {
        GameObject recastCutObject = new GameObject("Recast Cut Cylinder");

        AStarPathfindingRecastCut cut = recastCutObject.AddComponent <AStarPathfindingRecastCut>();

        cut.shapeType = AStarPathfindingRecastCut.Shape.cylinder;

        recastCutObject.AddComponent <CapsuleCollider>();

        Init(recastCutObject);
    }
Example #2
0
    public static void InitCube()
    {
        GameObject recastCutObject = new GameObject("Recast Cut Cube");

        AStarPathfindingRecastCut cut = recastCutObject.AddComponent <AStarPathfindingRecastCut>();

        cut.shapeType = AStarPathfindingRecastCut.Shape.cube;

        recastCutObject.AddComponent <BoxCollider>();

        Init(recastCutObject);
    }
Example #3
0
    public void OnPopulateZones(PopulateZonesPlayingEvent evt)
    {
        if (scanOnStartup && AStarPathfindingUtils.WillNavMeshBeBuiltFromInputMeshOnLevelBegin())
        {
            if (!astarData.cacheStartup || astarData.data_cachedStartup == null)
            {
                LevelHelper helper = GameObject.FindObjectOfType(typeof(LevelHelper)) as LevelHelper;
                if (helper != null)
                {
                    AStarPathfindingUtils.CreateRecastNavMeshForInputMeshes(helper.transform.Find(ZoneHelper.ZonesRootName), helper.isOverworldNavMeshRequired);
                    Scan();
                    EventManager.instance.Raise(new NavMeshScanEvent());
                }
            }
        }

        if (Application.isPlaying)
        {
            RecastGraph.DestroyWalkableAreaObjects();     // we don't need the instances of AStarPathfindingWalkableArea in the game after this point
            RecastGraph.DestroyRecastMeshObjComponents(); // RecastMeshObj's are only used for nav mesh generation, they are not needed after this point
            AStarPathfindingRecastCut.DestroyRecastCutObjects();
            AStarPathfindingGenerationTimeGeo.DestroyGenerationTimeGeoObjects();
        }
    }