Contents
When does steering away from an obstacle cause a collision?
The use of three vectors greatly improves the collision detection. The second problem happens when the character is close to the obstacle, steering away from it. Sometimes the maneuvering will cause a collision, even though the character is just rotating to face another direction:
When does the collision avoidance force become null?
Since all steering behaviors are re-calculated every game update, the avoidance force will remain active as long as the obstacle is blocking the way. As soon as the obstacle is not intercepting the ahead vector line, the avoidance force will become null (no effect) or it will be re-calculated to avoid the new threatening obstacle.
When is the avoidance force added to velocity?
The avoidance force is added to the player velocity as usual: Since all steering behaviors are re-calculated every game update, the avoidance force will remain active as long as the obstacle is blocking the way.
What happens when more than one obstacle is blocking the way?
If more than one obstacle is blocking the way, then the closest one (the “most threatening”) is selected for calculation: The closest obstacle (most threatening) is selected for calculation. The avoidance force must push the character away from the obstacle, allowing it to dodge the sphere.
How does collision avoidance work in a game?
Obstacles ahead of the character are analyzed and the closest one (most threatening) is selected. The collision avoidance behavior is not a path finding algorithm.
Why do NPCs need to be able to avoid obstacles?
This post is part of a series called Understanding Steering Behaviors. Decent NPC navigation often requires the ability to avoid obstacles. This tutorial covers the collision avoidance steering behavior, which allows characters to gracefully dodge any number of obstacles in the environment.
What is the basic idea of collision avoidance?
The basic idea behind collision avoidance is to generate a steering force to dodge obstacles every time one is close enough to block the passage. Even if the environment has several obstacles, this behavior will use one of them at a time to calculate the avoidance force.