Ok, can you link me to it please, i dont see if on the wiki!
Also, am trying to follow a terrain guide and am having an odd problem, the guide is:
http://www.jmonkeyengine.com/wiki/doku.php?id=loading_the_terrain
and the bit is where it defines tb = new TerrainBlock(yada yada yada) my machine says that the arguments are wrong, and suggests something like :
tb = new TerrainBlock("My Terrain",heightMap.getSize(), terrainScale, heightMap.getHeightMap(), new Vector3f(0,0,0), alphaBits, null,tpf);
However on running my code it gets a null pointer:
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import jmetest.TutorialGuide.HelloModelLoading;
import com.jme.bounding.BoundingBox;
import com.jme.bounding.BoundingSphere;
import com.jme.renderer.Camera;
import com.jme.scene.Node;
import com.jme.scene.shape.Box;
import com.jme.intersection.PickData;
import com.jme.intersection.PickResults;
import com.jme.intersection.TrianglePickResults;
import com.jme.math.Ray;
import com.jme.math.Vector3f;
import com.jmex.terrain.TerrainBlock;
import com.jmex.terrain.util.MidPointHeightMap;
public class base extends SimpleGame{
ArrayList nodes = new ArrayList();
private static final Logger logger = Logger
.getLogger(HelloModelLoading.class.getName());
TerrainBlock tb;
/**
* @param args
*/
public static void main(String[] args) {
base app = new base();
app.setConfigShowMode(ConfigShowMode.NeverShow);
// Turn the logger off so we can see the XML later on
app.start();
}
@Override
protected void simpleInitGame() {
// TODO Auto-generated method stub
//setup terrain
/*
Node node = Loader.loadModel("jmetest/data/model/sydney.md2");
node.setLocalScale(.1f);
node.setModelBound(new BoundingSphere());
node.updateModelBound();
node.setLocalTranslation(100, 50, 10);
nodes.add(node);
*/
buildTerrain();
rootNode.attachChild(tb);
Box b=new Box("My box yo",new Vector3f(0,0,0),new Vector3f(1,1,1));
rootNode.attachChild(b);
// b.setLocalTranslation(new Vector3f(10,100,1000));
}
/**
* Can be defined in derived classes for custom updating. Called every frame
* in update.
*/
protected void simpleUpdate() {
//do nothing
Ray ray = new Ray(cam.getLocation(), cam.getDirection());
PickResults results = new TrianglePickResults();
results.setCheckDistance(true);
rootNode.findPick(ray,results);
//check if we hit something
if(results.getNumber() > 0) {
PickData closest = results.getPickData(0);
System.out.println("The closest hit: " + closest.getTargetMesh().getName());
}
}
private void buildTerrain() {
// Generate a random terrain data
MidPointHeightMap heightMap = new MidPointHeightMap(64, 0.5f);
Vector3f terrainScale = new Vector3f(20, 0.5f, 20);
tb = new TerrainBlock("My Terrain",heightMap.getSize(), terrainScale, heightMap.getHeightMap(), new Vector3f(0,0,0), alphaBits, null,tpf);
tb.setModelBound(new BoundingBox());
tb.updateModelBound();
}
}
Any ideas :S I am using 2.0 if that makes any difference, and couldnt find any info on this :S