Overlapping terraingrid tiles

Hello,



I am playing around with the terraingrid and in my test run, I used the sample terraingrid file and removed the call to download the mountain.zip file. I also replaced the heightmap file to return a single heightmap:



[java] this.terrain = new TerrainGrid(“terrain”, 65, 257, new ImageBasedHeightMapGrid(assetManager, new Namer() {

public String getName(int x, int y) {

return “Scenes/TerrainAlphaTest/flat.png”;

}

}));

[/java]



Unfortunately, when I run the test, the tiles overlap as in the screenshot below:

http://imgur.com/1CGGP



Thoughts? Thanks in advance!

What are the dimensions of flat.png?

513x513 pixels.

You want the terrain heightmap image size to be the same as the terrain tiles.

When creating a Terrain Grid, the second parameter ‘maxVisibleSize’ will be twice the size of a tile. So in your case 257/2 = 128i. 128x128 is the size you want your heightmap image to be. There was probably a warning thrown in the log saying “Heightmap size is larger than the terrain size. Make sure your heightmap image is the same size as the terrain”.

That worked. Thanks for the help!