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

LSL Wiki : ExampleGetRootPos

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org
This function returns the position of the root object, even if called
from a child object.

-- Xylor

Also see llGetRootPosition.

vector GetRootPos() {
    // If this object is not linked, or if it is the
    // root object, just return llGetPos()
    integer LinkNum = llGetLinkNumber();
    
    if (LinkNum <= 1)
        return llGetPos();
        
    // Otherwise take local position into account.
    return llGetPos() - llGetLocalPos();
}

Examples
There are 4 comments on this page. [Display comments/form]