Skip to content

GetTerrainHeight

The terrain height at a point, from the level’s heightmap.

The server has a heightmap when [validation] heightmap names one the operator exported from the game; without one, or outside the sampled area, nil. Use it to place things on the ground where a z below 0 is not accepted.

GetTerrainHeight(x, y)
Parameter Type
x number metres
y number metres

number - metres; nil without a heightmap or outside it

local z = GetTerrainHeight(x, y) or -1
CreateProp("barrel_a", x, y, z)

GetPlayerPos · SetPlayerPos · the The world - clock, weather, terrain, the navmesh, the geometry group of the index