Terrain dimensions

I am currently working on putting a terrain (TerrainBlock generated by MidPointHeightMap) into my world scene.



What I want to do is to dimension this terrain in terms of width, depth and height. The first two are straight forward (size*step), however I cannot seem to find anyway to specify the height of the terrain. Which at the sizes I am using (e.g 20x20), results in a very distorted terrain model.



On another size related issue; is there a reason why I cannot set a Spatial’s scale in terms of its x,y and z ? a ‘setLocalScale(Vector3f localScale)’ would be nice…

What I want to do is to dimension this terrain in terms of width, depth and height. The first two are straight forward (size*step), however I cannot seem to find anyway to specify the height of the terrain. Which at the sizes I am using (e.g 20x20), results in a very distorted terrain model.


I'll add a setHeightScale method. It will be in before the end of the day.

On another size related issue; is there a reason why I cannot set a Spatial's scale in terms of its x,y and z ? a 'setLocalScale(Vector3f localScale)' would be nice...


I'll see about making the scale method take a Vector3f for (x,y,z) scales.

Ok, the change is in. It’s actually a change to the constructors. No longer do you send a float for the stepScale, but now you send a Vector3f object. Each axis is processed seperately, so you can have non-square terrain. This does mean all current users of terrain will need to make this change. If you want the same behaviour as before, for example:


TerrainBlock tb = new TerrainBlock("Terrain", heightMap.getSize(), 5, heightMap.getHeightMap(), new Vector3f(0,0,0), false);



would become

Vector3f sameScaleAsBefore = new Vector3f(5,1,5);
TerrainBlock tb = new TerrainBlock("Terrain", heightMap.getSize(), sameScaleAsBefore , heightMap.getHeightMap(), new Vector3f(0,0,0), false);



Hope that helps.

Can you explain what the last two new (at least I never noticed them before) options for the second TerrainPage constructor do?


  • @param offset the texture offset for the page.
  • @param offsetAmount the amount of the offset.



    Thanks!



    -Mike

They are used internally by Terrain Page to create a children (defines the position the texture map should start at for a particular block). It really isn’t ever used by a user. In fact, I think I will make it protected…