コード例 #1
0
    public static List <LVector3> FindPath(LVector3 fromPoint, LVector3 toPoint)
    {
        //allFindReq.Add(fromPoint);
        //allFindReq.Add(toPoint);
        Profiler.BeginSample("FindPath");
        var _ret = NavMesh.FindPath(fromPoint, toPoint, path);

        Profiler.EndSample();
        return(_ret);
    }
コード例 #2
0
ファイル: Test.cs プロジェクト: mengtest/LockstepPathFinding
    void DrawLine()
    {
        if (isFindPath)
        {
            Profiler.BeginSample(" FindPath");
            var time = DateTime.Now;
            pathPoints = NavMesh.FindPath(srcPoint.position.ToLVector3(), dstPoint.position.ToLVector3(), path);
            useTime    = (float)(DateTime.Now - time).TotalMilliseconds;
            Profiler.EndSample();
            //isDrawLine = false;
        }

        var graph = NavMesh.navMeshGraphPath;

        if (graph != null)
        {
            if (isShowPathResult)
            {
                ShowResult(graph);
            }
            if (isShowPathProgress)
            {
                ShowProgress(graph);
            }
            if (isShowAllTriangles)
            {
                ShowAllTriangles(graph);
            }
            if (isShowTriangleArea)
            {
                ShowAllConnections(graph);
            }
            if (isShowSingleTriangleConnection)
            {
                ShowOneTriangleConnections(graph);
            }
        }

        lineRenderer.positionCount   = pathPoints.Count;
        lineRenderer.widthMultiplier = widthMultiplier;
        lineRenderer.SetPositions(pathPoints.ToArray().ToVecArray());
    }