Skip to content
lsl.devlsl.devLSL Dev

llGround

function
Function syntax
float llGround(
  1. vector offset// Offset relative to the prim's position, expressed in local coordinates.
);
Returns
float
Energy
10

Returns a float representing the ground height directly below the prim's position offset by the vector offset.

Returns a float that is the ground height directly below the prim position + offset

How to use
float result = llGround(ZERO_VECTOR);
Example 1
// Makes the object land on ground or on water
FindGroundOrWater()
{
vector vTarget = llGetPos();
vTarget.z = llGround( ZERO_VECTOR );
float fWaterLevel = llWater( ZERO_VECTOR );
if( vTarget.z < fWaterLevel )
11 collapsed lines
vTarget.z = fWaterLevel;
llSetRegionPos(vTarget);
}
default
{
touch_start(integer total_number)
{
FindGroundOrWater();
}
}
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.

From the Second Life Wiki

Community documentation adapted from LlGround, by Linden Research, Inc. and contributing residents.View contributors and history.

Built from these wiki pages, as imported:

Licensed under CC BY-SA 3.0. Last wiki edit: .Formatting and links have been adapted for this site; API metadata follows the LSL definitions.