Class

GKGraphNode2D

A node in a navigation graph, associated with a point in continuous 2D space.

Declaration

@interface GKGraphNode2D : GKGraphNode

Overview

Together, a network of nodes form a graph that describes the navigability of a game world. Use graph nodes with a GKGraph, GKObstacleGraph, or GKMeshGraph 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 GKObstacleGraph or GKMeshGraph class to describe a game world in terms of open spaces interrupted by obstacles, GameplayKit automatically creates and manages GKGraphNode2D 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.

Topics

Creating a Graph Node

- initWithPoint:

Initializes a graph node with the specified point.

+ nodeWithPoint:

Creates a graph node with the specified point.

Inspecting a Node’s Position

position

The position of the node in continuous 2D space.

Relationships

Inherits From

See Also

Pathfinding

GKGraph

A collection of nodes that describes the navigability of a game world and provides pathfinding methods to search for routes through that space.

GKObstacleGraph

A navigation graph for 2D game worlds that creates a minimal network for precise pathfinding around obstacles.

GKMeshGraph

A navigation graph for 2D game worlds that creates a space-filling network for smooth pathfinding around obstacles.

GKGridGraph

A navigation graph for 2D game worlds where movement is constrained to an integer grid.

GKGraphNode

A single node in a navigation graph for use in pathfinding.

GKGraphNode3D

A node in a navigation graph, associated with a point in continuous 3D space.

GKGridGraphNode

A node in a navigation graph, associated with a position on a discrete two-dimensional grid.