Difference between revisions of "LlGetLocalPos"

From Second Life Wiki
Jump to navigation Jump to search
m
m
Line 3: Line 3:
|func=llGetLocalPos|sort=GetLocalPos
|func=llGetLocalPos|sort=GetLocalPos
|return_type=vector
|return_type=vector
|func_footnote=If called from the root prim it returns the [[Viewer coordinate frames#Region|position in the region]] unless it is [[llGetAttached|attached]] to which it returns the position relative to the [[Viewer coordinate frames#Attachments|attach point]].
|func_footnote=If called from the root prim it returns the [[Viewer coordinate frames#Region|position in the region]](if the script isn't physical) unless it is [[llGetAttached|attached]] to which it returns the position relative to the [[Viewer coordinate frames#Attachments|attach point]].
|func_desc
|func_desc
|return_text=that is the position relative ([[Viewer coordinate frames#Local|local]]) to the root.
|return_text=that is the position relative ([[Viewer coordinate frames#Local|local]]) to the root.

Revision as of 20:29, 21 April 2009

Summary

Function: vector llGetLocalPos( );
0.0 Forced Delay
10.0 Energy

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

If called from the root prim it returns the position in the region(if the script isn't physical) unless it is attached to which it returns the position relative to the attach point.

Examples

<lsl> 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" );
 }

}

</lsl>

Useful Snippets

There is no llSetLocalPos function. To set the position of a root prim local to itself you would have to do something like: <lsl> SetLocalPosition(vector local_position) {

  vector root_position = llGetPos();
  vector absolute_position = root_position + local_position;
  llSetPos(absolute_position);

} </lsl>

See Also

Functions

•  llGetRootPosition Gets the root prims global position
•  llGetPos Gets the prims global position
•  llSetPos Sets the prims global position

Deep Notes

Signature

function vector llGetLocalPos();