Obstacle Avoidance steering behavior

In this demonstration, the green vehicle avoids the gray obstacles. The vehicle tries to remain outside of the gray circles, while keeping close to its "speed limit." The vehicle wraps around the window boundaries. This steering behavior anticipates the vehicle's future path as indicated by the white box. The length of the box is a constant time multiplied by the current velocity of the vehicle. Any obstacle that intersects this box is a potential collision threat. The nearest such threat is chosen for avoidance and is marked with a green boundary. To avoid an obstacle, a lateral steering force is applied opposite to the obstacle's center. In addition, a braking (deceleration) force is applied. (These forces vary with urgency, the distance from the tip of the white box to the point of potential collision. Steering varies linearly, braking varies quadratically.) If avoidance fails and the vehicle overlaps an obstacle, the color of the obstacle changes to red. (With these parameters and this crowded environment, collisions occur about once every 800 simulation steps.) The vehicle's velocity is indicated by a magenta vector, and its steering force is indicated by a blue vector.

From
Steering Behaviors for Autonomous Characters