A navigation graph for 2D game worlds that creates a minimal network for precise pathfinding around obstacles.
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
You create an obstacle graph with a collection of
GKObstacle objects. To use the graph for pathfinding, you add
GKGraph 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
GKMesh class, an obstacle graph creates a minimal network of graph nodes, resulting in paths that are efficient but not smooth.