TerrainPage.getHeight() problem

hi,  everyone

I load a terrain page, but TerrainPage.getHeight() dont get my a correct value. in some places return NAN and in other the value its wrong, meaby the terrainScale is the problem?

RawHeightMap heightMap = new RawHeightMap(myUrl, tama

Hello daruk,



What are the vars "x" and "y"? If they are your naveNodo coordinates, you should take care of local/global coordinate systems. I mean, when you ask the Terrain for the height, you should use the addition of your object/node coordinates and those of the terrain.



Also, I've seen that you are using TerrainPage (class) instead of page (object). I think it is a copy-paste error :wink:



I think, your check code should be as follows:



if (
   page.getHeight(
       new Vector2f(
           page.getLocalTranslation().x+naveNodo.getLocalTranslation().x,
           page.getLocalTranslation().z+naveNodo.getLocalTranslation().z
           )
       )
       >= naveNodo.getLocalTranslation().y
   )
   {
        System.out.println("chocamos................................................");
         
   }



I had already this kind of errors with terrains some months ago...

PS: are you spanish? I'm saying because of your vars and print messages...

thanks, the problem are the local/global coordinates, and i am from colombia  :smiley:

the method returns NaN if x or y are outside the terrain. at some points, i believe it was where the pieces of the terrainpage (you are using a quadtree=terrainpage, not a terrainblock, right?) touch each other, the result is wrong for some reason. i ficed it in my local code more than a year ago, so i have no idea what exactly i did