llGetPos

From Second Life Wiki
Revision as of 22:28, 10 March 2010 by Fred Gandt (talk | contribs) (Added example to show how to access each float (.x etc))
Jump to navigation Jump to search

Summary

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

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.

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

Signature

function vector llGetPos();