I was wondering if unity can apply height maps to terrain in game, and also if unity can generate height maps in game. That would be useful since im trying to make a sand box game.
thanks
I was wondering if unity can apply height maps to terrain in game, and also if unity can generate height maps in game. That would be useful since im trying to make a sand box game.
thanks
function Start()
{
terrain = GetComponent(Terrain);
var nRows = 50;
var nCols = 50;
var heights = new float[nRows, nCols];
for (var j = 0; j < nRows; j++)
for (var i = 0; i < nCols; i++)
heights[j,i] = Random.Range(0.0,1.0);
terrain.terrainData.SetHeights (0,0,heights);
}
Yes, it can. Check the wiki. There’s a script for getting the terrain height from a heightmap, and it works at edit mode. You can change this to play mode. So yes, it is possible!