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
asked Oct 29 '10 at 10:42 PM
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.
answered Oct 30 '10 at 12:37 AM