Contents

GKMeshGraph

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

Declaration

class GKMeshGraph<NodeType> where NodeType : GKGraphNode2D

Overview

To use a mesh graph for pathfinding, add a collection of GKObstacle objects representing impassable areas and 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 GKObstacleGraph class, a mesh graph creates a space-filling network of graph nodes, resulting in paths that are smooth but not the most efficient.

To learn more about graphs and pathfinding, see Pathfinding in GameplayKit Programming Guide.

Topics

Creating a Graph

Working with Obstacles

Working with Nodes

Managing the Mesh

Constants

Instance Methods

Initializers

See Also

Pathfinding