- Home /
Get Height of Terrain in Script
I would like a script that places a certain number of capsules in various random places around my terrain. The random part is easy, I just use Random.value or something to that effect. However, I want my capsules to be just touching the terrain. Since my terrain is bumpy, I need to be able to get the height of the terrain for a given (x,z) coordinate.
So, given a point on the terrain, how do I get the height of the terrain at that point?
Answer by Eric5h5 · May 29, 2010 at 04:22 PM
There is a problem with this, in that you don't want the camera to move up or down exactly at the point beneath the camera. Ideally you'd want a radius around the camera that forces it to move up or down just before getting close to the terrain.
For example, if the camera is moving forward, you want to start raising the camera as it approaches a mountain, such that you don't look zoomed in on the mountain as your camera moves over it.
@CrzypNda Where did you get the idea about the camera from? He/she didn't ask anything about positioning a camera over the terrain, but a number of capsules.
Your answer
Follow this Question
Related Questions
Can I set a non-power-of-2 sized heightmap to terrain? 1 Answer
How not to fall through a mountain. 1 Answer
Instantiated Objects not being set at ground/terrain level?(Solved) 1 Answer
Overlapping terrains 1 Answer
Character height issue 0 Answers