A navigation graph for 2D game worlds that creates a minimal network for precise pathfinding around obstacles.
- iOS 9.0+
- macOS 10.11+
- tvOS 9.0+
You create an obstacle graph with a collection of
GKObstacle objects. To use the graph for pathfinding, you add
GKGraphNode2D objects representing points of interest (such as the current position of a game character and the location it needs to find a route to). Then use methods of the superclass
GKGraph to find routes through the graph.
Unlike the related
GKMeshGraph class, an obstacle graph creates a minimal network of graph nodes, resulting in paths that are efficient but not smooth.
To learn more about graphs and pathfinding, see Pathfinding in GameplayKit Programming Guide.
A collection of nodes that describes the navigability of a game world and provides pathfinding methods to search for routes through that space.
A navigation graph for 2D game worlds that creates a space-filling network for smooth pathfinding around obstacles.
A navigation graph for 2D game worlds where movement is constrained to an integer grid.
A node in a navigation graph, associated with a point in continuous 2D space.
A node in a navigation graph, associated with a point in continuous 3D space.
A node in a navigation graph, associated with a position on a discrete two-dimensional grid.