llSetPos

From Second Life Wiki
Function: llSetPos( vector pos );
0.2 Forced Delay
10.0 Energy

Moves the object or primitive towards pos without using physics.

• vector pos – position in region or local coordinates depending upon the situation (see #Specification).

Movement is capped to 10m per call for unattached root prims. Use llSetRegionPos to avoid this limit.[1]

Specification

Important: This function has a movement cap of 10m and a time delay of 0.2 seconds per call. Avoid these limits by using llSetRegionPos and/or llSetLinkPrimitiveParamsFast with PRIM_POSITION or PRIM_POS_LOCAL instead.

This function is available for nonphysical root prims and all child prims. It has no effect on the root prim if the object is physical.

Coordinate Frame

Caveats

  • This function causes the script to sleep for 0.2 seconds.
  • The coordinate frame used by llSetPos matches the coordinate frame used by llGetLocalPos, not llGetPos.
  • This function does not work in the root prim of physical objects. If you want instantaneous movement, set the object momentarily non-physical before setting its position; otherwise, use a function like llMoveToTarget for physical movement.
  • If you have explicitly set your object as "static obstacle" for pathfinding , the function will fail with the error in the debug channel:
    • "Unable to set prim position or scale: object contributes to the navmesh."
  • The function cannot move a world object below the region ground level, and the midpoint of the root will be snapped to the ground instead.

Examples

//Move the object up 1m when someone touches it.
default {
     touch_start(integer i) {
          llSetPos(llGetPos() + <0,0,1>);
     }
}
// to bypass the small movement bug use this
// - created by Madpeter Zond
// notes: it does not check if the movement would go out of limit range for linked prims
llSetLocalPos(vector offset)
{
    vector save = offset;
    if(offset.x < 0.0) offset.x -= 1;
    else offset.x += 1;
    if(offset.y < 0.0) offset.y -= 1;
    else offset.y += 1;
    if(offset.z < 0.0) offset.z -= 1;
    else offset.z += 1;
    llSetPos(offset);
    llSetPos(save);    
}

Notes

  • Positional movements of unselected in-world objects are visually damped by the viewer. There is no way to control this behavior via scripts and it has no effect on the prim's reported position.

See Also

Functions

•  llSetRegionPos – Sets position of object to any position within the region.
•  llGetLocalPos – Returns the prim's local position if it is attached or non-root (otherwise it returns the global position)
•  llGetRootPosition – Gets the root prims position
•  llGetPos – Returns the prim's global position, even if it is attached or non-root

Deep Notes

Footnotes

  1. ^ Before llSetRegionPos, the 10m limit could be avoided using the warpPos bug.

Signature

function void llSetPos( vector pos );