# llGround

*LSL function*

```lsl
float float llGround(vector offset);
```

- `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](https://wiki.secondlife.com/wiki/float) that is the ground height directly below the [prim position](/functions/llGetPos/) + **offset**

```lsl title="How to use" frame="terminal"
float result = llGround(ZERO_VECTOR);
```

## Examples

<details open>
<summary>Example 1</summary>

```lsl collapse={9-19}
// 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 )
        vTarget.z = fWaterLevel;
    llSetRegionPos(vTarget);
}

default
{
    touch_start(integer total_number)
    {
        FindGroundOrWater();
    }
}
```

</details>

## See also

### Functions

- [llGroundContour](/functions/llGroundContour/) — Gets the ground contour
- [llGroundNormal](/functions/llGroundNormal/) — Gets the ground normal
- [llGroundSlope](/functions/llGroundSlope/) — Gets the ground slope
- [llEdgeOfWorld](/functions/llEdgeOfWorld/) — Returns existence of neighboring sims

---

*Source: [LlGround](https://wiki.secondlife.com/wiki/LlGround) on the Second Life Wiki. Content from the Second Life Wiki articles LlGround (revision 1194292, 2015-01-22) and Template:LSL Function/offset (revision 1169422, 2012-06-18), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llGround/
