Problem setting the height of a TerrainGrid

Hello, a friend and I have attempted to change the height to our terrain to make an in-game map editor. This has proven problematic as the TerrainGrid will not let us get the height of the terrain out of a set area, it returns NaN instead.

Here is an example of what happens:

When we call .getHeightmapHeight on our TerrainGrid object it returns NaN, while it works perfectly in the initially loaded chunk.

We are getting our coods from a raypick. Any help would be great!

Anyone have any ideas?

Just guessing here but this might be because the terrain grid does not have the terrain quad you are trying to manipulate loaded. Why it is not loaded no one can tell since we don’t know how you create your coordinates (physics raypicking or scenegraph? is the terrain quad in sight? are you sure the coordinates are correct…)

Check how getHeightMapHeight is implemented: http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainGrid.java

it calls directly into terrain quad:
http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java

Which checks if the coordinates are “inside” that terrain quad and if not returns NaN. So this is my guess to what is happening.

I would approach this by debugging into the jME classes and try to see what the coordinates really are, probably they are not what is expected.