Difference between revisions of "LlGetPos"

From Second Life Wiki
Jump to navigation Jump to search
m (added function "sort" parameter so entry appears in correct section in category page)
m (Added example to show how to access each float (.x etc))
Line 21: Line 21:
         llSay(0, (string)position);
         llSay(0, (string)position);
     }
     }
}
}</lsl><lsl>
</lsl>
default
{
    on_rez(integer param)
    {
        // Access each of the floats in a vector separately.
        vector pos = llGetPos();
        float X = pos.x;
        float Y = pos.y;
        float Z = pos.z;
        llSetPos(<(X - 2.0), Y, (Z + 10.0)>);
    }
}</lsl>
|helpers
|helpers
|also_functions=
|also_functions=

Revision as of 23:28, 10 March 2010

Summary

Function: vector llGetPos( );

Returns a vector that is the the position of the task in region coordinates

Caveats

  • When called from the root of an attachment, returns the wearer's position. When called in any child prim, always returns that prim's region position.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl> default {

   touch_start(integer total_number)
   {
       // When touched, check the position of
       // the object, save it to "position",
       // then convert it into a string and
       // say it.
       vector position = llGetPos();
       llSay(0, (string)position);
   }

}</lsl><lsl> default {

   on_rez(integer param)
   {
       // Access each of the floats in a vector separately.
       vector pos = llGetPos();
       float X = pos.x;
       float Y = pos.y;
       float Z = pos.z;
       llSetPos(<(X - 2.0), Y, (Z + 10.0)>);
   }
}</lsl>

See Also

Functions

•  llGetLocalPos Gets the prim local position
•  llGetPrimitiveParams Gets prim properties
•  llGetRootPosition Gets the root prims position
•  llSetPos Sets the prim position
•  llSetPrimitiveParams Sets prim properties
•  llSetLinkPrimitiveParams Sets linked prim properties

Deep Notes

Search JIRA for related Issues

Signature

function vector llGetPos();