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

LSL Wiki : llGetRootPosition

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl809.us.archive.org
vector llGetRootPosition()

Gets the position (in region coordinates) of the root/parent prim of the object containing the script. This is used to allow a child prim to determine where the root is.

Compare with llGetPos and llGetLocalPos.

Note: there is not currently a way to set the root prim's position from a child prim. To do so, a script is needed in the root to recieve a link message

When called in the child prim of an attachment, the function returns the position of the avatar, as llGetPos would in the parent prim.

Actually, you can set the root prim at the position of the geometric center of the object using a simple function:
root2Centre() //puts the root prim at the geometric centre of the object
{
    vector myPos = llGetPos();
    vector rootPos = llGetRootPosition();
    vector rootOffset = rootPos - myPos;
    llSetPos(myPos - rootOffset);
}
You could also make a parameter for the function to set the root prim at a specified distance:
setRootPos(vector pos) //puts the root prim at the specified position
{
    vector destPos = pos;
    vector myPos = llGetPos();
    vector rootPos = llGetRootPosition();
    vector rootOffset = rootPos - myPos;
    llSetPos(destPos - rootOffset);
}
- Haz


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

Functions | Root | Position | Link
Comments [Hide comments/form]
Attach a comment to this page: