Need help with terrainData.GetHeight

Hi,

I am trying to randomly place objects in the game and need to know what height the terrain has at a specific position. From what I understand terrainData -> GetHeight(x,y) is the way to do so. The documentation does not give much info on how to use this though.

Can anyone explain how this works or how to get what I am after?

Thanks in advance /Jens

You probably want Terrain.SampleHeight instead. If you have to use TerrainData for some reason, then you'd want GetInterpolatedHeight. The x and y values that you supply are normalized to the terrain, so that 0.0, 0.0 is the lower-left corner, and 1.0, 1.0 is the upper-right corner. See here.