Hi, this is my code.
[java]FractalHeightMapGrid grid = new FractalHeightMapGrid(ground, null, 256f);
this.terrain = new TerrainQuad(“terrain”, 65, 513, grid.getHeightMapAt(Vector3f.ZERO).getHeightMap());
// this.terrain = new TerrainGrid(“terrain”, 65, 513, grid);
this.terrain.setMaterial(this.mat_terrain);
this.terrain.setLocalTranslation(0, -150f, 0);
Client.getInstance().getRootNode().attachChild(this.terrain);
List<Camera> cameras = new ArrayList<Camera>();
cameras.add(Client.getInstance().getCamera());
TerrainLodControl control = new TerrainLodControl(this.terrain, cameras);
this.terrain.addControl(control);[/java]
I’m trying to just get one single TerrainQuad out of the FractalHeightMapGrid but I’m obviously doing something wrong. (I truly miss the totalSize in my attempt.) If I uncomment line 3 and comment out line 2 (then it is like the TerrainGridTest) it works. I took a look at TerrainGrid.java but still don’t get it. Thanks for any advice.
Regards
annih
You’re missing one simple step, that;s happening behind the curtains. Before calling getHeightMapAt(Vector3f) you must call setSize(513). TerrainGrid sets this according to it’s size settings.
K, thank you. As I said I was missing this setting anyway. ^^ Seems I wasn’t looking properly enough.