TriangleNavMesh extends NavMesh { private boolean findPath(Vector3 fromPoint, Vector3 toPoint, TriangleGraphPath path) { path.clear(); Triangle fromTriangle = getTriangle(fromPoint); if (pathFinder.searchConnectionPath(fromTriangle, getTriangle(toPoint), heuristic, path)) { path.start = new Vector3(fromPoint); path.end = new Vector3(toPoint); path.startTri = fromTriangle; return true; } return false; } TriangleNavMesh(String navMeshStr);  TriangleNavMesh(String navMeshStr,int scale); TriangleGraph getGraph(); TriangleHeuristic getHeuristic(); IndexedAStarPathFinder<Triangle> getPathFinder(); List<Vector3> findPath(Vector3 fromPoint, Vector3 toPoint, TrianglePointPath navMeshPointPath); Triangle getTriangle(Vector3 point); Vector3 getPointInPath(float x, float z);  }
@Test public void testPerformance() { TriangleGraphPath path=new TriangleGraphPath(); TrianglePointPath pointPath=new TrianglePointPath(); long start=TimeUtil.currentTimeMillis(); List<Vector3> list=null; for(int i=0;i<10000;i++) { list = navMesh.findPath(new Vector3(27,16f,482f), new Vector3(87f,13f,898f), pointPath); } System.err.println("耗时："+(TimeUtil.currentTimeMillis()-start)); if(list!=null) { list.forEach(v->System.out.println(v.toString())); } }
@Test public void testFindPath() { TrianglePointPath pointPath=new TrianglePointPath(); List<Vector3> list = navMesh.findPath(new Vector3(104, 138), new Vector3(212.0f,232.0f), pointPath); if(list!=null) { list.forEach(v->System.out.println(v.toString())); } }