A node in a navigation graph, associated with a point in continuous 2D space.
SDKs
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
Framework
- Gameplay
Kit
Declaration
class GKGraphNode2D : GKGraph Node
Overview
Together, a network of nodes form a graph that describes the navigability of a game world. Use graph nodes with a GKGraph
, GKObstacle
, or GKMesh
object to perform actions that relate to the network of nodes as a whole, such as pathfinding to determine routes through the network.
When you use the GKObstacle
or GKMesh
class to describe a game world in terms of open spaces interrupted by obstacles, GameplayKit automatically creates and manages GKGraph
instances that represent positions along possible paths that navigate around those obstacles.
To learn more about graphs and pathfinding, see Pathfinding in GameplayKit Programming Guide.