Initializes a path with the specified array of 2D points.
SDKs
- iOS 9.0+
- macOS 10.11+
- tvOS 9.0+
Framework
- Gameplay
Kit
Declaration
- (instancetype)initWithPoints:(vector_float2 *)points count:(size_t)count radius:(float)radius cyclical:(BOOL)cyclical;
Parameters
points
An array of 2D points representing the vertices in the path. The order of points in this array determines the order in which an agent follows the path.
count
The number of elements in the
points
array.radius
The radius of the path.
cyclical
YES
if the path’s end point should connect to its start point; otherwiseNO
.
Return Value
A new path object.
Discussion
The radius
parameter defines the space occupied by the path—think of this space as the area created by sweeping a circle of the specified radius along the path from vertex to vertex. Agents with path-related goals will attempt to move to or stay within this area.
The cyclical
parameter determines whether the path loops around on itself. If the path is cyclical, an agent with a follow-path goal will proceed around the path indefinitely. If the path is not cyclical, an agent following the path will stop at the last point in the path.
To use the newly created path to constrain an agent’s behavior, create a goal with the goal
or goal
method.