Skip to content

GetGroundZ

The surface under a point.

The height of the first surface under the point - a ray from half a metre over it, 100 m down: the paving, a bridge, a roof, an upper storey, wherever the level’s geometry is. Where the geometry has nothing (open terrain), nil: ask GetTerrainHeight then. Where a spawn, a prop or a teleport should land.

GetGroundZ(x, y, z)
Parameter Type
x number metres
y number metres
z number metres, the height to look down from

the height in metres, or nil when nothing is under the point (or without the geometry)

local floor = GetGroundZ(x, y, z) or GetTerrainHeight(x, y) or z
SetPlayerPos(pid, x, y, floor)

GetTerrainHeight · GetNavmeshHeight · RayCast · the The world - clock, weather, terrain, the navmesh, the geometry group of the index