Difference between revisions of "LlSetHoverHeight"

From Second Life Wiki
Jump to navigation Jump to search
(64m limit is missing)
(example)
Line 12: Line 12:
|caveats=*Do not rely on built-in limits. In the past, the difference between the object's initial position and the hover height was limited to 64 meters. Under SL Server 1.26.2 there is no apparent limit.
|caveats=*Do not rely on built-in limits. In the past, the difference between the object's initial position and the hover height was limited to 64 meters. Under SL Server 1.26.2 there is no apparent limit.
|constants
|constants
|examples
|examples=
<lsl>
// Put in an attached prim and touch to start floating in air without flying.
// Touch again to drop to the ground.
 
integer gHovering = FALSE; // are we supposd to be hovering now?
 
default {
    touch_start(integer total_number) {
        if (!llGetAttached()) {
            llWhisper(0, "Wear me to play.");
            return;
        }
 
        if (gHovering) {
            llOwnerSay("Releasing you.");
            llStopHover();
        }
        else {
            llOwnerSay("Making you float...");
 
            // Start hovering 5 meters over our current location.
            vector myPosition = llGetPos();
            llSetHoverHeight(myPosition.z - llGround(ZERO_VECTOR) + 5.0, FALSE, 1.0);
        }
 
        gHovering = !gHovering; // flip the switch
    }
}
</lsl>
|helpers
|helpers
|also_functions={{LSL DefineRow||[[llGroundRepel]]| Same as llSetHoverHeight but does not hover all the time}}
|also_functions={{LSL DefineRow||[[llGroundRepel]]| Same as llSetHoverHeight but does not hover all the time}}

Revision as of 04:00, 2 May 2009

Summary

Function: llSetHoverHeight( float height, integer water, float tau );
0.0 Forced Delay
10.0 Energy

Critically damps to a height above the ground (or water) in tau seconds.

• float height Distance above the ground
• integer water boolean, if TRUE then hover above water too.
• float tau seconds to critically damp in

Do not use with vehicles.
Use llStopHover to stop hovering.

Caveats

  • Only works in physics-enabled objects.
  • Do not rely on built-in limits. In the past, the difference between the object's initial position and the hover height was limited to 64 meters. Under SL Server 1.26.2 there is no apparent limit.

Examples

<lsl> // Put in an attached prim and touch to start floating in air without flying. // Touch again to drop to the ground.

integer gHovering = FALSE; // are we supposd to be hovering now?

default {

   touch_start(integer total_number) {
       if (!llGetAttached()) {
           llWhisper(0, "Wear me to play.");
           return;
       }
       if (gHovering) {
           llOwnerSay("Releasing you.");
           llStopHover();
       }
       else {
           llOwnerSay("Making you float...");
           // Start hovering 5 meters over our current location.
           vector myPosition = llGetPos();
           llSetHoverHeight(myPosition.z - llGround(ZERO_VECTOR) + 5.0, FALSE, 1.0);
       }
       gHovering = !gHovering; // flip the switch
   }

}

</lsl>

See Also

Functions

•  llGroundRepel Same as llSetHoverHeight but does not hover all the time
•  llStopHover To stop hovering

Deep Notes

Signature

function void llSetHoverHeight( float height, integer water, float tau );