- Home /
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
Answer by Eric5h5 · Oct 30, 2010 at 12:37 AM
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.
Your answer
Follow this Question
Related Questions
When i place objects, it follows me instead of be on the terrain 0 Answers
Can't use tree brush tool 0 Answers
error with instance of TerrainData? 1 Answer
TerrainData.GetHeights NEED HELP 2 Answers
Make a simple tree 1 Answer