Scene setup

Let's get started by setting up our scene:

  1. Let's create a few walls to block the line-of-sight from our AI character to the enemy. We make these out of short—but wide—cubes that have been grouped under an empty game object called Obstacles.
  2. We add a plane as a floor.
  3. Finally, we add a directional light so that we can see what is going on in our scene.

We represent the player with a tank, similar to what we used in our first example, and we represent the NPCs with simple cubes. We also have a Target object to show us where the tank is moving in our scene. Our scene hierarchy should look similar to the following screenshot:

How ...

Get Unity Artificial Intelligence Programming - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.