In this section, we'll set up a scene as shown in the following screenshot, and make our AI entity avoid the obstacles while trying to reach the target point. The algorithm presented here using the
raycasting method is very simple, so it can only avoid the obstacles blocking the path in front of it. The following screenshot will show us what our scene will look like:
To create this, we make a few cube entities and group them under an empty game object called Obstacles. We also create another cube object called
Agent and give it our obstacle avoidance script. We then create a ground plane object to assist in ...