Book Image

Unity AI Programming Essentials

By : Curtis Bennett
Book Image

Unity AI Programming Essentials

By: Curtis Bennett

Overview of this book

Table of Contents (19 chapters)

The Smart Car AI demo


Now, we'll start setting up our driving demo that will have a car driving along a road and avoiding obstacles.

Setting up a Unity test scene

Besides needing Smart Car, we'll need an environment for our AI cars to drive in. We'll use Car Tutorial v1.3 that is made by Unity, which you can download for free from the Asset Store. Import the project and open TheTrack scene from the imported Scenes folder. Next, add a car to the scene. The car prefab that comes with Car Tutorial doesn't have the complete wheel physics setup, so you can configure it using the steps in the last section or use the EnemyAICar prefab from Smart Car. To make the car work better with the Tutorial scene, extend the rays a little, set Wide and Tight Ray Distance both to 40 and Long Ray Distance to 50. This keeps the car from hitting obstacles when going too fast and missing tight turns. Once you have a car in the scene configured for Smart Car, select the Main_Camera object and set your car to Target...