Overview
Via a Unity Editor script, I am loading a GIS elevation GRID via a header txt file and binary float file. I am reading the large data set, choosing the nearest power of 2 and filling a corner with the real data. Then I break the large data set in to 513x513 terrain chunks and create the Terrains and gameObjects.
I am getting LOD seams between the TerrainChunks but only after starting the simulation, just after creating the tiles in the editor and before pressing play I can see that the terrain.setNeighbor() is working correctly. But pressing play and going into game mode changes that and the seams can be seen, after stoping the game simulation the terrain chunks continue to not respect the neightbors LOD.
Relevant Code
for( int y = 0; y < numberOfChuncks; y++ )
{
for( int x = 0; x < numberOfChuncks; x++ )
{
Terrain left = null;
Terrain top = null;
Terrain right = null;
Terrain bottom = null;
// Terrain Tile layout
// (x,y)
// (0,2)(1,2)(2,2)
// (0,1)(1,1)(2,1)
// (0,0)(1,0)(2,0)
//TOP
if( y == numberOfChuncks - 1 )
top = null;
else
top = terrainObject[x,y+1].GetComponent();
//BOTTOM
if( y == 0 )
bottom = null;
else
bottom = terrainObject[x,y-1].GetComponent();
//LEFT
if( x == 0 )
left = null;
else
left = terrainObject[x-1,y].GetComponent();
//RIGHT
if( x == numberOfChuncks - 1 )
right = null;
else
right = terrainObject[x+1,y].GetComponent();
//MAKE IT SO
terrainObject[x,y].GetComponent().SetNeighbors( left, top, right, bottom );
terrainObject[x,y].GetComponent().heightmapPixelError = 2;
}
}
Questions
Do I need to update Terrain.setNeighbors per frame?
Is the fact that this is a Editor Scrip restricting the neighbors to only the editor window?
Thanks
Chase