# llGroundRepel

*LSL function*

```lsl
void llGroundRepel(float height, integer water, float tau);
```

- `float height`: Target distance in meters above the ground or water.
- `integer water`: Boolean. If TRUE, damp relative to the higher of land and water; if FALSE, damp relative to land only.
- `float tau`: Timescale in seconds to critically damp the movement.

- Energy: 10

Critically damps the object's vertical motion to height (using critical damping timescale tau) if it is within height * 0.5 of the terrain (or water level if water is TRUE). Only works on physics-enabled objects; do not use with vehicles.

Critically damps to **height** if within `height * 0.5` of ground or water level (which ever is higher).

Do not use with vehicles.

```lsl title="How to use" frame="terminal"
llGroundRepel(0.0, 0, 0.0);
```

## Specification

Does not pull the object down if it is stuck higher than that, unlike the similar [llSetHoverHeight](/functions/llSetHoverHeight/).

To stop `llGroundRepel`, this seems to work: `llGroundRepel(0.0, FALSE, 0.0)`

## Caveats

- This is not a prim property; stopping or resetting the script stops `llGroundRepel`; same with the similar [llSetHoverHeight](/functions/llSetHoverHeight/)
- Crossing a sim border will cancel `llGroundRepel`, unlike [llSetHoverHeight](/functions/llSetHoverHeight/)
- A negative height value allows you to hover underwater, same as [llSetHoverHeight](/functions/llSetHoverHeight/)
- A previous version of this page suggested that [llStopHover](/functions/llStopHover/) will stop `llGroundRepel`, but it does not

## Examples

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

```lsl
default
{
    state_entry()
    {
        llSetStatus(STATUS_PHYSICS, TRUE);
        llGroundRepel(0.5, TRUE, 0.2); // In a 1/2 meter cube this is roughly the minimum height for any noticeable effect.
        // to
        llGroundRepel(4096.0, TRUE, 0.2); // There is no restrictive maximum.
        // However as the prim reaches 4096 meters (bear in mind the prim height will be (float height + ground height))
        // it will be too high to be allowed to exist.
    }
}// This is actually a remarkably fast way to go straight up!!
```

</details>

## See also

### Functions

- [llSetHoverHeight](/functions/llSetHoverHeight/) — Similar to `llGroundRepel`, but also pulls down

---

*Source: [LlGroundRepel](https://wiki.secondlife.com/wiki/LlGroundRepel) on the Second Life Wiki. Content from the Second Life Wiki articles LlGroundRepel (revision 1216224, 2024-02-18), Template:LSL Function/physical (revision 1168828, 2012-06-11) and Template:LSL Function/damping (revision 1168795, 2012-06-11), CC BY-SA 3.0.*

---

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