Terrain height

Hi,
How can I find terrains heigth (y) in the exact location (x, z)?
My terrain is created with built-in terrain generator.

I think you need to look at these:

should get you pointed in the right direction at least…

i searched just Terrain.smth not TerrainData.smth

Found this: GetHeight(x: int, y: int): float;
Hope this helps me.
thanks

or maybe: Unity - Scripting API: Terrain.SampleHeight

(not played with terrain, other than creating it… does it show :stuck_out_tongue: lol)

y=TerrainData.GetHeight(x,z);
BCE0020: An instance of type ‘UnityEngine.TerrainData’ is required to access non static member ‘GetHeight’.
I get this error :frowning:

y=Terrain.activeTerrain.terrainData.GetHeight(x,z);

transform.position.y = Terrain.activeTerrain.SampleHeight(transform.position);
This works great.
Thanks again.

y=Terrain.activeTerrain.terrainData.GetHeight(x,z) ; works too.