com.badlogic.gdx.ai.pfa.indexed.IndexedAStarPathFinder Java Examples

The following examples show how to use com.badlogic.gdx.ai.pfa.indexed.IndexedAStarPathFinder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AStartPathFinding.java    From Pacman_libGdx with MIT License 5 votes vote down vote up
public AStartPathFinding(AStarMap map) {
    this.map = map;
    this.pathfinder = new IndexedAStarPathFinder<Node>(createGraph(map));
    this.connectionPath = new DefaultGraphPath<Connection<Node>>();
    this.heuristic = new Heuristic<Node>() {
        @Override
        public float estimate (Node node, Node endNode) {
            // Manhattan distance
            return Math.abs(endNode.x - node.x) + Math.abs(endNode.y - node.y);
        }
  };
}
 
Example #2
Source File: NavMesh.java    From GdxDemo3D with Apache License 2.0 5 votes vote down vote up
public NavMesh(Model model) {
	btTriangleIndexVertexArray vertexArray = new btTriangleIndexVertexArray(model.meshParts);
	collisionShape = new btBvhTriangleMeshShape(vertexArray, true);
	raycastCallback = new NavMeshRaycastCallback(navMeshRayFrom, navMeshRayTo);
	raycastCallback.setFlags(btTriangleRaycastCallback.EFlags.kF_FilterBackfaces);
	graph = new NavMeshGraph(model);
	pathFinder = new IndexedAStarPathFinder<Triangle>(graph);
	heuristic = new NavMeshHeuristic();
}