Game Development Reference
In-Depth Information
FIG 7.27 (a) An L-system street
map and (b) L-system progression
of a building.
Although the programming of an algorithm to build a 3D L-system city
is beyond the scope of this topic, it is possible using Perlin Noise and
existing building models to generate a city. This is the topic of the next
workshop.
Unity Hands On
Procedural Cities
Step 1. Create a new Unity project and import the Character
Controller package.
Step 2. Add a plane to the scene and an FPC. Position the FPC just
above the plane and add a directional light as shown in Figure 7.19 .
Scale the plane's x and z sizes to 10.
Step 3. Download Chapter Seven/Perlin.js from the Web site. Add the
file to your Project inside a new folder called Plugins .
Step 4. Create a JavaScript file named makeCity and reuse the code
from Listing 7.3 .
Step 5. Play. What you should have is the heightened terrain from the
previous example. Now instead of heights we will add buildings.
Step 6. If you put a print statement inside the for loop in makeCity
.js and print out the height values being assigned to the plane,
you'll notice they range between - 4 and 4. We will use these
values to assign buildings instead of terrain heights. Go to
Turbosquid and download eight models of various types of houses
Search Nedrilad ::




Custom Search