Seek, Flee and Arrive Behaviours

These three behaviours are very similar in that they all have a world position ('target') produce forces that tend to move the agent either towards or away from.

Seek

seek behaviour forces

The seek steering behaviour returns a force that directs an agent toward a target position. It first calculates the desired velocity. This is the velocity the agent would need to reach the target position in an ideal world. It represents the vector from the agent position to the target scaled to match the agents maximum speed. The steering force is then the force needed to bring the current velocity to the desired velocity.

The agent will generally overshoot the target and then turn round and approach again. The amount of overshoot depends on the ratio of the agents's maximum speed to its maximum force.

Flee

Flee is the opposite to seek and it creates a force that steers the agent away from the target. Once the agent is far enough away (the flee distance) the force drops to zero.

Arrive

Arrive is similar to seek but the force is calculated so that the agent decelerates as it approaches the target, eventually coming to a halt. The rate of deceleration can be either slow, normal or fast.