Creates a graph with the specified list of obstacles.
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
An array of obstacle objects, each of which describes a polygon-shaped impassable area.
The distance from obstacle edges that should also be considered impassable.
A new obstacle graph.
This method generates a graph that can be traversed in all directions, except into the areas occupied by 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.