Edit Terrain

I am having a small problem, my modified code of the terraintestmodifyheight.java does not work :frowning:







//creating the terrain

terrain = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());

TerrainLodControl control = new TerrainLodControl(terrain, camera);

terrain.addControl(control);

terrain.setMaterial(matRock);

terrain.setLocalScale(new Vector3f(2, 2, 2));

terrain.setLocalTranslation(new Vector3f(511.5f,50.5f,511.5f));

terrain.setLocked(false); // unlock it so we can edit the height

rootNode.attachChild(terrain);





//edit the terrain

terrain.getTerrain().adjustHeight(pos, 0.01f);

terrain.getTerrain().updateModelBound();



Any suggestions what I might be missing?

Thank you in advance :wink:



Dustin

Anything a bit more specific than “Does not work”?



Do you have an error? Is it not doing what you want it too? If not then what’s it supposed to do?



Usually I find to get a good reply here you have to provide more details than “It’s borken”

Thank you for your answer :slight_smile:



Well it should modify the terrain, but nothing happens ^^

Still a flat area (heightmap is black).

Never mind, got it to work now.

The position a ray hits the terrain at is: hitPos - the size of the terrain -.-

pos.x -= 512;

pos.y -= 512;



Thanks again :wink: