Many of the recipes in this chapter are built on this basic project, which constructs a scene with a textured terrain, a downward facing Main Camera, and a red cube (as shown in the following screenshot) that can be moved around by the user using the four directional arrow keys.
To create a player-controlled cube, perform the following steps:
Start a new project by navigating to Terrain Textures | GoodDirt.psd from the Terrain Assets Unity package (uncheck all of the other contents of this package as we don't need them and they'll just bloat the size of the project).
Create a terrain, positioned at (-15, 0, -10) and sized 30 by 20.
Note
Transform position for terrains relates to their corner not their center
Since the
Transform
position of terrains relates to the corner of the object, we center such objects at (0, 0, 0) by setting the X-coordinate equal to (-1 x width/2) and the Z-coordinate to (-1 x length/2). In other words, we...