Initializes a graph to cover the specified area.
- iOS 10.0+
- macOS 10.12+
- Mac Catalyst 13.0+
- tvOS 10.0+
The distance from obstacle edges that should also be considered impassable.
The minimum coordinate of the space to be covered by the graph.
The maximum coordinate of the space to be covered by the graph.
A new mesh graph.
A newly created graph contains no obstacles and no graph nodes. First, use the
add method to add obstacles. Next, use the
triangulate() method to fill the open space between obstacles with a web of graph nodes, allowing pathfinding operations to result in smooth paths around obstacles.
buffer parameter to take the size of potential travelers into account when determining navigability. For example, if a game character that will use pathfinding has a radius of 20 units (in the same coordinate space you use to define obstacles), specify a buffer radius of 20. As a result, the graph will consider any points within 20 units of an obstacle non-navigable—that is, pathfinding in the graph will not result in any positions that lie inside this buffer region, so you can safely set the character’s center point to the location of a node returned from the
find method without the character overlapping any obstacles.