Extras

There are some additional scripts in the Terrain Tools package that you might find useful.

Crater Maker

The Crater Maker script allows you to, well, make craters in your terrain. With some noise (if you want), smooth edges, change of height and texture. You can define the radius and depth.

To use it, attach the Crater Maker script to your terrain, then call the Create() function every time you want to make a crater. The script Create Crater On Impact shows you an example of how you can accomplish the effect of a bomb or missile hitting the terrain.

All units are world-units.

Two Warnings:

Random Object Map (optional)

Precondition: Nothing

This script allows you the random-but-guided-by-a-distribution-map placement of any game object whatsoever. It works much like the tree, grass, etc. map scripts, except that it will interpret the map you give it as a grayscale "probability" of placing an object.

Max Number is the maximum number of objects the script will place. The actual number can be lower if your distribution map is largely black and the script has trouble finding valid spots, especially if you use a high spacing value (see below). For most reasonable numbers (i.e. a few hundred objects or less), the actual number of objects will usually be very close to the max number.

Spacing is the amount of space (in map units, not world units!) that you want to leave around each object. Use this to ensure that objects are not spawned so close that they intersect with each other. The default value of 1 should be good for most smaller objects, but if you use the script to place huge rocks, buildings or other large objects, you may want to increase it.

Above Ground is the number of world units that objects will be offset from the terrain (or other ground object). Use this for floating objects, or use a negative value to put objects partially into the ground (e.g. rocks, etc.). Note that this offset is relative to the unit center. A sphere will be placed half into the ground if Above Ground is zero, since that is where the object center is.

Use Layer allows you to control which layers are raycast against when finding the Y (height) value to place objects. You can use this to ensure that objects are only placed on terrain, for example, not on any objects that might sit on top of it already — or on the contrary, to make sure that your randomly spawned objects always sit on top of everything else.

Terrain/PlaceSelectionOnTerrain

This will simply lower/raise the currently selected editor object so that its origin sits square on the terrain. Very useful to place stuff on your terrain. Can have multiple game objects selected.

Scripts/PlaceOnSurface and Scripts/KeepOnSurface

Much like the editor script above, except that these are intended for use at runtime. One will place the object it is attached to on top of the terrain (or other objects) in Start(), the other will keep placing it in Update(). This is an easy way to animate walking people, driving cars, etc. without worrying about the Y axis.

Scripts/SpawnInArea

This allows you to add yet another procedurally generated element. This script will take a spawnmap and spawn/position something randomly inside that spawnmap on your terrain.

I use this to generate maps that exclude the corners of the map, the very edge, and anything where the steepness of the terrain is too high. On maps with water, you can also use spawnmaps to make sure that the player (or objects, etc.) isn't spawned over/in water.

Scripts/TerrainQualitySettings

A simple script that will change the terrain quality in response to the game's quality settings. You should check and modify the values included depending on your particular game, and you need to integrate this into your game so that it is attached to a game object but also called whenever the quality settings are changed.

Scripts/TreeExplosion

A simple script I released before on the Unity forums. It shows how you can access individual trees, for example if you want to make your forests destructable. It's simple, but really nifty.