First off I know that this sort of question has been asked 101 times already on here, but I’ve honestly read a good 80% of them, and none offer me anymore information than I currently have.
I’m prototyping out a game which requires a really simple low-res terrain, and I eventually stumbled onto a few Perlin Noice tutorials. This is the function I have currently:
public void GenerateTerrain(float tileSize){
TerrainData TD = selfTerrain.terrainData;
//Higher = More Hills/Mountains
float HM = Random.Range(0,10);
//Lower = Higher Mountains/Hills
float divRange = Random.Range(12,25);
int height = TD.heightmapHeight;
int width = TD.heightmapWidth;
float[,] heights = new float[width,height];
for(int i = 0; i < width; i++){
for(int k = 0; k < height; k++){
heights[i,k] = Mathf.PerlinNoise((i/width) * tileSize, (k/height) * tileSize) / divRange;
}
}
Debug.Log("DivRange: " + divRange + " , " + "HTiling: " + HM);
TD.SetHeights(0,0,heights);
}
but instead of making me some nice ripply terrain it applies the same height to the whole terrain object, essentially just moving it up and down. The happens event when I use Random.Range to just put a random height onto every location in the heightmap.
If its something stupid, please don’t rub it in, I’ve been up for probably a bit too long.
Cheers in Advance