Skip to content
lsl.devlsl.devLSL Dev

llGetPos

function
Function syntax
vector llGetPos();
Returns
vector
Energy
10

Returns a vector representing the current position of the object in region coordinates.

How to use
vector result = llGetPos();
  • 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.

Example 1
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);
}
}
Example 2
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!");
}
}
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.

From the Second Life Wiki

Community documentation adapted from LlGetPos, by Linden Research, Inc. and contributing residents.View contributors and history.

Imported wiki revision:

Licensed under CC BY-SA 3.0. Last wiki edit: .Formatting and links have been adapted for this site; API metadata follows the LSL definitions.