Don't click here unless you want to be banned.

LSL Wiki : llGetPos

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org
vector llGetPos()

Returns the prim's position in region coordinates, which are relative to the simulator's southwest corner.

When called from within a child prim in a linked set, it returns the position of the child in region coordinates, not the parent's position. To get the position of a child object relative to its parent, use llGetLocalPos. To get the position of the parent from a script within a child prim, use llGetRootPosition.

When used in the root of an object attached to an avatar, it will always return the position of the avatar's center in region coordinates. When used in a child object in attachments, it will return the position of the child, in region coodinates, if the root was at avatar center and the root had zero rotation relative to this avatar center.

Example:
// say location when touched
default {
    touch_start(integer num_detected) {
        llSay(0, "I'm at " + (string)llGetPos());
    }
}

Q: As of SL 1.6.7, the editor tooltip for llGetPos says "gets the position (if the script isn't physical)". Is that true? Does this only work on non-physical objects?
A: No, it's not true. The tooltip is in error. (It's misleading as well. A script can't be physical; only objects can.) llGetPos will return the current position regardless of physics status.

Q: Is llGetPos().x valid? (I can get a single component of a vector like so: vector_name.x.)
A: No, in LSL, you can only act upon a component of a vector that exists as a variable. You need to declare a vector first.

Use llSetPos to set the object's position.

See also llGetPrimitiveParams.


This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Dynamics | Position
There is one comment on this page. [Display comments/form]