TerrainToolkit.TextureTerrain

Method


function TextureTerrain(slopeStops : float[], heightStops : float[], textures : Texture2D[]) : void

Description

Procedurally textures the terrain object by height and slope. Note that slopeStops must contain 2 stops and heightStops must contain 2 stops for each height-assigned texture after the first (i.e. not including the slope-assigned texture or the first height-assigned texture) as per the example below. The textures array contains a list of all of the textures to be assigned to the terrain object. The slope-assigned texture is always the first Texture2D item in the textures array.

e.g. For 4 textures there must be 2 slope stops, 4 height stops and 4 textures.

Note: The procedural terrain texturing tool is limited to 1 slope-assigned texture and between 1 and 5 height-assigned textures.

See the Texture page for more information about this tool.

Returns

Nothing.

Example

Note: This example assumes that cliffTexture, sandTexture, grassTexture and rockTexture are assigned Texture2D variables

var go : GameObject = GameObject.Find("Terrain");
var slopeStops : float[] = [20.0, 50.0];
var heightStops : float[] = [0.2, 0.4, 0.6, 0.8];
var textures : Texture2D[] = [cliffTexture, sandTexture, grassTexture, rockTexture];
go.GetComponent("TerrainToolkit").TextureTerrain(slopeStops, heightStops, textures);

Texturing

Terrain Toolkit