PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

GetWaypoints

This function returns an array of all the DataType/PathWaypoint|PathWaypoints in a Path, as computed by Path/ComputeAsync.

Each waypoint in the array specifies a DataType/Vector3 position and Enum/PathWaypointAction|action to take when this PathWaypoint is reached. The array is arranged in the order of waypoints from the path start to path end.

If a path could not be computed, this function will return an empty array.

Returns

Return Type Summary

An array of DataType/PathWaypoint|PathWaypoints ordered from path start to path end


Code Samples


Get Path Waypoints

The example below demonstrates how to create a Path and it’s DataType/PathWaypoint|PathWaypoints using the PathService.

It tries to PathService/ComputeAsyc a path between two DataType/Vector3 positions, from pathStart to pathEnd. If a path is successfully created, indicated by it’s Enum/PathStatus, the code block gets an array of its waypoints using PathService/GetWaypoints. Then, it loops through the array and prints each waypoint’s position.