Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class TerrainStuff : MonoBehaviour {
- Terrain terrain;
- // Use this for initialization
- void Start () {
- terrain = GetComponent<Terrain>();
- TerrainData data = terrain.terrainData;
- float[,] heights = data.GetHeights(0, 0, data.heightmapWidth, data.heightmapHeight);
- for( int x=0; x<512; ++x)
- {
- for( int z=0; z<512; ++z)
- {
- heights[x,z] = Mathf.Sin ( x*0.05f ) * 0.2f + 0.2f;
- if (z==0) { Debug.Log(heights[x,z]); }
- }
- }
- data.SetHeights(0, 0, heights);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment