front-end / back-end: AIMFollowWaypoints
| Follow
inherits from: AIMFollowPath
The behaviour Follow Waypoints lets your agent go after a sorted sequence of points. This can be useful in many different scenarios, for example, in patrols, racing tracks or for path following in general.
Polarith AI currently provides two comfortable variants for obtaining the point data. First, with the help of the property PathConnector
, you can refer to any component which inherits from AIMPathConnector
either by using the inspector or by using the API directly (of course, this includes the inbuilt components Linear Path as well as Unity Pathfinding). Second, if no PathConnector
is assigned, then you can alternatively set the point data manually with the help of the property Points
.
The underlying mechanism of the behaviour is quite simple. It follows one point after another until the final destination has been reached. Depending on what you have set on the property Patrol
, the agent either goes on patrolling back and forth or restarts at the beginning of the path in a circular manner. So the order of the points is very important. By taking advantage of the given parameters, you can precisely control the iteration process. For example, you can specify the iterative direction (forwards or backwards depending on the given StepSize
), or the currently targeted (way)point with the help of the property TargetIndex
.
This component has got the following specific properties.
Property | Description |
---|---|
TargetIndex | Determines the specific (way)point which is currently targeted. |
StepSize | Sets the iteration rate such that next TargetIndex = current TargetIndex + StepSize. Note that this can also be a negative value for traversing the path backwards. |
TargetRadius | Determines the minimum distance between a targeted point and the agent so that this point is considered as reached. |
Patrol | Determines how a path is traversed after the agent has reached the end respectively the start of the path. For more information, have a closer look at the underlying enumeration PatrolType . |