Follow is a behavior node which enables the prefab to follow its leader. The Follow behavior encompasses two actions : back off and approach. During following, the prefab tries to  maintain a target distance between itself and its target.  When the distance is smaller than a min distance, the prefab will choose to back off. When it is larger than a max distance, the prefab will choose to approach.

Follow Field

Name TypeDescription
targetfunction or tableTarget entity that the prefab is trying to follow
min_distintegerminimum distance before prefab begins to back off
target_distintegerThe desired distance the prefab try to maintain from the leader
max_distintegermaximum distance before prefab begins to approach
canrunbool(optional) used to determine if the prefab need to run

The three distances(min_dist, target_dist, max_dist) are used for the prefab to determine its action during Follow behavior. Noticeably, when the distance between prefab and its target is between min_dist and max_dist, the follow behavior will  be in a failed state. (the behavior is not activated)


Follow State Diagram

The Follow Behavior has 4 states: Ready, Running, Failed,Success.