Simple collision avoidance AI in Unity3D

I’m currently working on a small 3D arcade game inspired by classical top down races in Unity3D. The game will feature enemy opponents, which means that they have to have at least some kind of AI. This AI consists of simple collision avoidance algorithm, so that the enemies don’t crash into walls constantly, and a very simple path following algorithm so that the opponents can find their way around the racetrack. I’ve built a quick prototype with simple boxes and a path.

I’ve also made a short video about what I’ve achieved so far. The algorithm is a bit imprecise and it takes the adversaries a relatively long time to find their way around an obstacle, but it works for now. I’m absolutely going to improve the algorithm, so that the behaviour looks more natural and real.

As you can see in the video, sometimes the AI enemies ignore the walls. This happens because the enemy hasn’t found a way around it. I want to fix this too.

You can take a quick look at it here:

Stay tuned here at nerdhut to see updates about this project and to get the game once it is done! Maybe I’ll also publish the source code and a tutorial afterwards.