I’ve had a problem with getHeightAtCoordinates() for several days that I haven’t been able to resolve.
Explanation :
When we create a terrain and give it a position 0,5,0 getHeightAtCoordinates works as it should. But if I move the terrain on the x and z axis, getHeightAtCoordinates no longer behaves correctly.
Why am I moving the terrain ?
For my project, I created several plots of land one next to the other of 512x512 in order to create a large terrain of 2048x2048.
I then have a tool (a brush) to paint the textures (I use MixMaterial) This brush so when it is on a terrain far from the center of the world obtains coordinates which exceed 512 (size of a terrain). This is where getHeightAtCoordinates is no longer correct.
In this PG I created two examples :
Example 1: shows a terrain that I moved to -110, 5, 110
Example 2: He is in comments. This works by setting the ground to coordinate 0, 5, 0.
On my side I don’t see any problem on the value returned by getHeightAtCoordinates
Have a look at this Playground I did from your code : I placing a sphere on the returned value, to make sure. I’m moving the ground arround, and also the picked coordinate is not zero (10,10)
I dropped the terrain conversion. This creates too much worry for me.
I’m going to change my approach to create the terrain so that I no longer have this problem.