Difference between revisions of "LlGetPos"

From Second Life Wiki
Jump to navigation Jump to search
m (Altered an example.)
m (<lsl> tag to <source>)
(11 intermediate revisions by 4 users not shown)
Line 5: Line 5:
|func_footnote
|func_footnote
|func_desc
|func_desc
|return_text=that is the the position of the task in [[Viewer coordinate frames#Region|region]] coordinates
|Return_text=position of the task in [[Viewer coordinate frames#Region|region]] coordinates
|spec
|spec
|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.
|caveats=*When called from the root of an attachment, returns the wearer's region position. To see the position used, enable '''Develop>Avatar>Display Agent Target''' and use the red crosshair. If the avatar is sitting on an object, the red crosshair may be hidden by the white one, in the same position.
 
*When called in an attachment's child prim, the position given is again relative to the ''avatar's'' root position and rotation, but with the offset from the root prim added. Visually, the reported position will only be correct if the object's root is attached to [[ATTACH_AVATAR_CENTER]], at [[ZERO_ROTATION]] and [[ZERO_VECTOR]]. Moving the attachment's root or changing the attachment point will not affect the reported position. Avatar animation is invisible to the simulator, so it also does not affect the reported position.
|constants
|constants
|examples=<lsl>
|examples=<source lang="lsl2">default
default
{
{
     touch_start(integer total_number)
     touch_start(integer total_number)
Line 21: Line 22:
         llSay(0, (string)position);
         llSay(0, (string)position);
     }
     }
}</lsl><lsl>
}</source>
default
<source lang="lsl2">default
{
{
     on_rez(integer param)
     on_rez(integer param)
Line 32: Line 33:
         llOwnerSay("Oooh! I'm up high!");
         llOwnerSay("Oooh! I'm up high!");
     }
     }
}</lsl>
}</source>
|helpers
|helpers
|also_functions=
|also_functions=

Revision as of 02:43, 22 January 2015

Summary

Function: vector llGetPos( );

Returns the vector position of the task in region coordinates

Caveats

  • When called from the root of an attachment, returns the wearer's region position. To see the position used, enable Develop>Avatar>Display Agent Target and use the red crosshair. If the avatar is sitting on an object, the red crosshair may be hidden by the white one, in the same position.
  • When called in an attachment's child prim, the position given is again relative to the avatar's root position and rotation, but with the offset from the root prim added. Visually, the reported position will only be correct if the object's root is attached to ATTACH_AVATAR_CENTER, at ZERO_ROTATION and ZERO_VECTOR. Moving the attachment's root or changing the attachment point will not affect the reported position. Avatar animation is invisible to the simulator, so it also does not affect the reported position.
All Issues ~ Search JIRA for related Bugs

Examples

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);
    }
}
default
{
    on_rez(integer param)
    {
        // Adding .x .y or .z after the vector name can be used to get the float value of just that axis.
        vector pos = llGetPos();
        float Z = pos.z; // <--- Like this.
        if(Z > 500.0)
        llOwnerSay("Oooh! I'm up high!");
    }
}

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