Time for action – up hill and down dale
We have seen how to generate a terrain from a heightmap using ImageBasedHeightMap
or the SDK. This type of terrain is the one that you have most control over, and you will probably use it most often. jMonkeyEngine can also generate a random heightmap if you need a quick and dirty solution.
Perform the following steps to generate a simple random heightmap for a hilly terrain:
- Return to your copy of
TerrainSimple.java
. - Comment out the line that generates the
ImageBasedHeightMap
. - Add a line that generates a
HillHeightMap
.AbstractHeightMap heightmap = null; try { // heightmap = new ImageBasedHeightMap(// heightMapImage.getImage(), .5f ); heightmap = new HillHeightMap(1025,500,50,100,(byte)3); heightmap.load(); ...
Get jMonkeyEngine 3.0 Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.