Hi Guys
Ive been bashing my head against this problem for about a day now with no success… So i thought i would post it her to see if any one had any ideas…
I started with TerrainGridTest which worked great…
But i wanted a more earth like terrain so i downloaded a heightmap guillotined it into 16 pieces. and used that. And that worked great too!!
But now wanted two more things.
- the terrain was just too rough. looked a bit like minecraft.
- i wanted a pre-created NavMesh for my charaters
so using the SDK scene composer I created 16 empty jme3 scenes. Added a terrain to each scene based on each of the height maps. and applied a consistent level of smoothening, and generated a NavMesh for each.
then i created
class CustomTileLoader implements TerrainGridTileLoader {
public TerrainQuad getTerrainQuadAt(Vector3f location) {
final int roundX = Math.round(location.x);
final int roundZ = Math.round(location.z);
String modelName = assetPath + "/" + name + "-" + roundX + "-" + roundZ + ".j3o";
Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Load terrain grid tile: {0}", modelName);
TerrainQuad quad = null;
try {
Node model = (Node) manager.loadModel(modelName);
quad = (TerrainQuad)model.getChild("terrain-world_grid-" + roundX + "-" + roundZ);
quad.setMaterial(null);
} catch (Exception e) {
//e.printStackTrace();
}
if (quad == null) {
Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "Could not load terrain grid tile: {0}", modelName);
quad = createNewQuad(location);
} else {
Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Loaded terrain grid tile: {0}", modelName);
}
return quad;
}
Which is basically a copy of AssetTileLoader customized to load terrains from the jme3 scenes i created. But Alas i can not get it to work… It seems to find the terrains but Im just seeing the skybox instead of any terrain. Soo…
Is this a good idea ? is this a good approach to get a smoothened realistic explorable terrain?
Any ideas as to where i might have screwed up?
So my files are indexed 0-3 so world_grid-0-1.j3o is that ok or does it need start with negative numbers… It didnt seem to matter when i was working with just heightmaps