- Home /
Question by
Digital-Phantom · Feb 02, 2015 at 07:23 AM ·
instantiateterrainheight
How would I make an instantiated object appear at exact level of my terrain
How can I make sure instantiated objects are always going to be placed at the height of my terrain
Although my game is 3D the placement of objects/prefabs takes place in a top down view almost exactly the way its done in RTS games. (The object will be placed according to where the mouse is clicked)
Comment
Best Answer
Answer by Kiwasi · Feb 02, 2015 at 07:35 AM
Two methods come to mind
Raycast down from a suitable height above the terrain
Read the height from a height map
For most applications the raycasting will do fine. If you are after supreme commander like numbers of units, then explicitly reading from a height map will perform better.
Your answer