Skip to content
lsl.devlsl.devLSL Dev

LlWater

Looking for the current API? Open the llWater reference →

Function notes

Water height is constant across each entire sim and is typically 20 meters but not always.

Return value notes

Returns a float that is the water height below the prim's position + offset

Examples

// 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();
    }
}

See also: functions

Shared wiki helpers

The original page also injects shared parameter notes, caveats or issue information through these helpers. Their conditional MediaWiki logic is not reproduced here; inspect the preserved helper source for additional material.

Template:LSL Function/offset

Original shared helper source (conditional wiki logic is not evaluated)
{{LSL Injection Test}}<noinclude></noinclude>{{#if:

{{#vardefine:p_{{{1|}}}_desc|offset relative to the {{#switch:{{{local|}}}|*|=prim's|#default={{{local|}}}|object=object's}} position and expressed in [[Viewer coordinate frames#Local|local coordinates]]{{#if:{{{dead|}}}|&#32;and is completely ignored.}}{{{desc|}}}}}

{{#vardefine:p_{{{1|}}}_hover|offset relative to the {{#switch:{{{local|}}}|*|=prim's|#default={{{local|}}}|object=object's}} position and expressed in local coordinates{{#if:{{{dead|}}}|&#32;and is completely ignored.}}{{#if:{{{hover|}}}|{{{hover|}}}|{{{desc|}}}}}}}

{{#if:{{{dead|}}}|{{#vardefine:caveats|{{#var:caveats}}
*{{LSLP|{{{1|}}}}} functionality {{#switch:{{{dead|}}}|never=has not been implemented|*|#default=has been removed}}, any value provided is completely ignored. For future proofing purposes, you should use a [[ZERO_VECTOR]] for it's value.}}
}}

{{#if:{{{sim|}}}{{{region|}}}|
{{#vardefine:header_footnote|{{#var:header_footnote}}{{PBR}}
The requested position needs to be in the same region.}}
}}

{{#if:{{{noZ|}}}|
{{#vardefine:header_footnote|{{#var:header_footnote}}{{PBR}}
Only the {{LSLP|x}} and {{LSLP|y}} coordinates in {{LSLP|offset}} are important, the {{lSLP|z}} component is ignored.}}
}}

}}<noinclude>
{| {{Prettytable}}
|-{{Hl2}}
!var
!value
|-
|desc
|{{#var:p_{{{1|}}}_desc}}
|-
|hover
|{{#var:p_{{{1|}}}_hover}}
|}
</noinclude>
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 LlWater, 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.