I’m trying to add terrain to a unity game with code, then move it’s center to (0,0).
Eventually I realized I can create it using:
GameObject map = Terrain.CreateTerrainGameObject(new TerrainData());
The problem is positioning it. I can change where it is, but after a few hours of looking, I still can’t find the width/height/depth of the terrain. My best guess is:
map.transform.Translate(new Vector3(map.GetComponent<Mesh>().heightmapWidth/2, 0, map.GetComponent<TerrainData>().heightmapWidth/2));
But that obviously doesn’t work right.