Skip to content
lsl.devlsl.devLSL Dev

LlGetLocalPos

Looking for the current API? Open the llGetLocalPos reference →

Function notes

If called from the root prim it returns the position in the region unless it is attached to which it returns the position relative to the attach point.

Return value notes

Returns a vector that is the position relative (local) to the root.

Examples

default
{
    touch_start(integer vIntTouched)
    {
        string vStrMessage = "The touched prim is ";
        if (llDetectedLinkNumber(0) > 1)
        {
            vStrMessage += (string)llVecMag(llGetLocalPos()) + "m from ";
        }
        llSay(0, vStrMessage + "the root prim");
    }
}

Helper functions

There is no function to set the position of a prim local to itself.
To set the position of a prim local to itself you would have to do something like:
SetPositionLocalToCurrentPosition(vector local_position)
{
    llSetPos(llGetLocalPos() + (local_position * llGetLocalRot()));
}
Or:
SetPositionLocalToCurrentPosition(vector local_position)
{
    llSetPos(llGetPos() + (local_position * llGetRot()));
}

See also: functions

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 LlGetLocalPos, 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.