How to get terrain height at X and Y coordinates in C++?

Jim_Clow
Wed, 24 Apr 2019 20:25:02 +0000
World Creation

Hi , does anyone know how to get the z value for terrain at a particular x and y world coordinate using c++?

I could look at the height map itself to calculate heights, but all that would give me is a height of a peaks and troughs, rather than at some point in between them, which is what I’m after.

Googling around it would seem that a line trace may be the answer I am looking for, but I can’t find any C++ examples of this, or even anything similar that I could adapt for my purpose.

Ultimately I want to use C++ to align spline meshes to terrain. An easy job, if I can just get a terrain Z values whilst I’m getting the x,y location values along a spline.

4 posts - 3 participants