Download

Get Z Coordinate (Height) of the landscape with given x and y coordinates

Hey,
i need to use the z coordinate or in other words the height of the landscape at a given x and y coordinate in a BP. I read something about doing it with linetrace (Trace channel: landscape), but i didnt find this option anymore. Does somebody got an idea on how to do it within a BP?

Thanks for your help!

Hi, you can just create a new trace channel and call it “landscape”. Then set the default behavior to ignore this trace channel, so that every object in your world will ignore it. Then set your landscape to block this channel. So then only your landscape will block this channel, everything else will ignore it.

So “project settings” -> “collision” -> “new trace channel” -> set the “default response” to ignore -> select your landscape -> set it to block this newly created trace channel.

Then to get the height of the landscape at a x,y position, just do a linetrace with this channel.

@chrudimer I will try this, thank you :slight_smile:

what are you using the trace on?
Because normally if you are using an actor you just get the local world Z - for instance. rather then have to do a line trace.

I just need the specific z coordinates of the landscape at certain points. After googling for some time the only option i found was to do a linetrace. The solution with the new trace channel works fine^^

You could alternatively read the pixel of the height-map if you already have that in use somewhere - like maybe to generate a mini-map…