how can I do that in certain parts of the land, the land rises and lowers automatically ?
1 Answer
1If you want to move the entire terrain up and down, a simple solution is to control its transform.position (attach this script to the terrain):
public range: float = 0.5; // how much terrain swings up and down (meters)
public speed: float = 6.28; // 6.28 * cycles per second
private p0: Vector3;
function Start(){
p0 = transform.position;
}
function Update(){
transform.position = p0 + Vector3.up * range * Mathf.Sin(speed * Time.time);
}
But things are way more complicated if you want to move only parts of the terrain: you must somehow define the region you want to move, get the current heights in this region in an square array with GetHeights, modify and assign them back with SetHeights.
Take a look at Terrain and the [TerrainData][1] class in the script reference, more specifically the SetHeight function [1]: http://docs.unity3d.com/Documentation/ScriptReference/TerrainData.html
– Josh707I need that the land rises and lowers automatically continuously without stopping
– mateyic