Talk:LlGetLocalPos

From Second Life Wiki
Jump to navigation Jump to search

Equivalent Functionality

Ok, as far as I have been able to test, this code should be true: <lsl>llGetLocalPos() == (llGetPos() - llGetRootPosition()) / llGetRootRotation()</lsl> Caveat: While the formula is functionally equivalent, a built-in function usually takes much less time to execute. Cron Stardust 20:14, 18 March 2008 (PDT)

No true llSetLocalPos for root.?

"There is no llSetLocalPos function. To set the position of a root prim local to itself you would have to do something like:

SetLocalPosition(vector local_position)
{
   vector root_position = llGetPos();
   vector absolute_position = root_position + local_position;
   llSetPos(absolute_position);
}

"

Is this really setting the root prims position local to itself? If you are adding a local position to the root's position in this manner(say +<1,0,0>, which would be in front of the object) would that move the root to the position in front of it even if it was rotated? I know this is true with child prims and the llSetPos function now (the function sets the position relative to the root prim, no matter how it is rotated, just as llSetLocalPos would work) but the function above only seems to move the object down the default region axes and I have been hard pressed to find a function that does this for the root prim and its children (i.e. when the vector floats are added the object moves down its own local axes), or at least one that works for non-physical objects. I am assuming that you would have to divide the "absolute position" by the root rotation as stated in Cron's previous comment here, or is there a function I don't know about that does this? --L33r0y Trenkins 00:26, 25 March 2008 (PDT)

It depends what you consider as local for a root prim. -- Strife Onizuka 15:32, 26 March 2008 (PDT)