Reader small image

You're reading from  Unity AI Programming Essentials

Product typeBook
Published inDec 2014
Publisher
ISBN-139781783553556
Edition1st Edition
Tools
Right arrow
Author (1)
Curtis Bennett
Curtis Bennett
author image
Curtis Bennett

Curtis Bennett has been a developer in the games and computer graphics industry for several years. He has worked on developing immersive virtual environments, published research in visual simulation, taught college courses in game development, and worked for various game studios, and he was also an engineer on early versions of the RAIN AI plugin for Unity. Currently, he is the Technical Director for Creative Services at Ideum, which focuses on creating interactive media projects.
Read more about Curtis Bennett

Right arrow

RAIN's demo


The basic start of the demo will be similar to our others, a ground with several walls around for our ships to travel. This is how the basic starting point of our demo should look:

The basic starting point of our demo

One of the first things we will need is the ability to query a random location in the scene to spawn and find points to travel to. Create a class called Ground and add it to the ground plane. This class will be used to provide higher-level information about the level, the first of which is being able to find a random position in the level. Here is the Ground class with the random position chooser method:

In the preceding code, we are able to ask for a random position at anytime from anywhere in the game. In the Start method for the Ground class, we store the max and min positions for it, and as we don't want positions on the very edge of the level, it is scaled to 90 percent by multiplying by 0.9f. The min and max positions are static, so we can add a static method...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Unity AI Programming Essentials
Published in: Dec 2014Publisher: ISBN-13: 9781783553556

Author (1)

author image
Curtis Bennett

Curtis Bennett has been a developer in the games and computer graphics industry for several years. He has worked on developing immersive virtual environments, published research in visual simulation, taught college courses in game development, and worked for various game studios, and he was also an engineer on early versions of the RAIN AI plugin for Unity. Currently, he is the Technical Director for Creative Services at Ideum, which focuses on creating interactive media projects.
Read more about Curtis Bennett