SHARE
TWEET
Untitled
a guest
Nov 2nd, 2016
65
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- private IndexedAStarPathFinder<Node> pathFinder = new IndexedAStarPathFinder<Node>(MapManager.graph, false);
- private GraphPath<Node> resultPath;
- private int startX, startY, endX, endY;
- private Node startNode, endNode;
- private PathFinderRequest<Node> request = new PathFinderRequest<Node>(startNode, endNode, heuristic, resultPath);
- public void initPath(){
- startX = (int) (aiSteering.getPosition().x);
- startY = (int) (aiSteering.getPosition().y);
- endX = (int) (aiSteering.getTarget().getPosition().x);
- endY = (int) (aiSteering.getTarget().getPosition().y);
- startNode = MapManager.graph.getNodeByXY(startX, startY);
- endNode = MapManager.graph.getNodeByXY(endX, endY);
- waypoint.setTarget(aiSteering.getTarget());
- request.startNode = startNode;
- request.endNode = endNode;
- request.heuristic = heuristic;
- if(resultPath != null &&resultPath.getCount() > 0)
- {
- resultPath.clear();
- }
- if(request.resultPath != null && request.resultPath.getCount() > 0)
- {
- request.resultPath.clear();
- }
- pathFinder.search(request, 1000000000);
- resultPath = request.resultPath;
- }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

