Difference between revisions of "LlGetPos"

From Second Life Wiki
Jump to navigation Jump to search
m
Line 7: Line 7:
|Return_text=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.
|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, always returns that prim's region position. This value is not where it appears on screen, but instead it is relative to the ''avatar's'' root position and rotation, but with the correct distance from the root prim. To see the root position used, enable '''Develop>Avatar>Display Agent Target'''. If the avatar is sitting on an object, the off-white crosshair is the avatar position; at all other times use the red crosshair. 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.
 
*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 correct offset. 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>default
|examples=<lsl>default

Revision as of 22:24, 25 July 2011

Summary

Function: vector llGetPos( );
0.0 Forced Delay
10.0 Energy

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 correct offset. 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.

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)
   {
       // 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!");
   }
}</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

Signature

function vector llGetPos();