Obstacle Avoidance

obstacle avoidance detection box

An obstacle is any entity that can be approximated by a circle, and obstacle avoidance is a behaviour that steers the agent to avoid them if they are in its path.

To do this a rectangular box is projected in front of the agent in the direction it is travelling. If the box (detection box) collides with the obstacle then a steering force is calculated so the agent misses the obstacle

obstacle avoidance forces

The detection box width is twice the collision radius and the length increases with the agent's speed, so is affected further away from the obstacle.

The calculated steering force is a combination of a lateral force, to turn the agent, and a breaking force, to slow the agent, resulting in realistic movement.