Game Development Reference
In-Depth Information
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 impor-
ted 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 us-
ing 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 for the Car Camera script.
If you start the demo now, the car still won't run but the main camera in the scene will
follow it:
This screenshot is of the Main_Camera game object of Car Tutorial. These are the
settings for the TheTrack scene with Target set to the Smart Car prefab.
Search WWH ::




Custom Search