private void GenerateTileHeightmap(Tile tile) { float positionStep = tileSize / tileResolution; float xPos = -(positionStep * tileResolution) + (tile.location.x * tileSize); float zPos = -(positionStep * tileResolution) + (tile.location.y * tileSize); for (int x = -1; x <= tileResolution + 1; x++) { zPos = -(positionStep * tileResolution) + (tile.location.y * tileSize); for (int z = -1; z <= tileResolution + 1; z++) { tile.heightmap[x + 1, z + 1] = heightmapProvider.GetHeight(xPos, zPos); zPos += positionStep; } xPos += positionStep; } }