BUG found in terrain.getHeight(x,z)

1 reply [Last post]
Joined: 11/23/2013



While using a png image file (1024x1024) as a heightmap I get some height values that are wrong when using terrain.getHeight(x, z) function.   It works most of the time but I noticed then for some specific values of x and z the function returns zero instead of the height of that particular point. The terrain is rendered properly with the correct heights everywhere according to the heightmap.


Some values that don't work: 


z = -64 

from x= -128 to x = -64


the whole line of z=-192

this only happens when x and z are whole numbers. z= -192 ; x = 0.1 works fine but ( -192 ; 0) does not

and it doesint happen all the time either. Is their a way I could be using this wrong ?? 


That is all I tested I hope this helps.



Joined: 12/13/2010
Ah yes, you have discovered

Ah yes, you have discovered that the terrain map engine has a bug where if your value is right at the edge of the tile (say 64 or 128), it will return 0. 

In reality, this is not a huge problem as these are floating point values and will not be at the exact integer value (it is only a problem when you set these initial values).

Let me know if this is the case for you and I'll try to investiage.