Hello, I have search around for this but I can only find out how to make an infinite terrain which I have done. But my issue is, getting the seams to lineup. How would I go about this. I know I would need to set the heights of the terrains for each but I’ve not scripted terrain too much. So I was wondering if anyone could point me in the right direction so I may be able to get this done. Apologies in advanced if there is another post covering this, but if there is could I get a link. I couldn’t find anything resolving this issue when searching around so I decided to ask myself.
Edit: When I speak of seams, I mean the height of them. I want the heights to line up. Continuing to search this issue.
The Code bellow reads and then write a unity terrain, you would just have to modify it to compare heights of all neighboring terrains and set them to the same values…
using UnityEngine;
using System.Collections;
public class MakeCrater : MonoBehaviour {
private TerrainData terrain ;
private float[] heightmap;
private int i,j;
void Start ()
{
terrain = GameObject.Find("Terrain").GetComponent<Terrain>().terrainData;
heightmap = new float[terrain.heightmapWidth * terrain.heightmapHeight];
float[,] tData = terrain.GetHeights(0, 0, terrain.heightmapWidth, terrain.heightmapHeight);
for (i = 0; i < terrain.heightmapHeight; i++)
{
for (j = 0; j < terrain.heightmapWidth; j++)
{
tData[i,j] = tData[i,j]; // Check for edges and change here to match
}
}
terrain.SetHeights(0, 0, tData);
}
}
Thank you, I appreciate it.