Difference between revisions of "LlGetRootPosition"

From Second Life Wiki
Jump to navigation Jump to search
(added example/helper/aslo functions)
Line 8: Line 8:
|caveats
|caveats
|constants
|constants
|examples
|examples=
|helpers
<lsl>
|also_functions
default{
  touch_start( integer vIntTouched ){
    string vStrMessage = "The prim with this scipt is ";
    if (llGetPos() != llGetRootPosition()){
      vStrMessage += "NOT ";
    }
    llSay( PUBLIC_CHANNEL, vStrMessage + "centered on the root prim." );
  }
}
</lsl>
|helpers=
<lsl>
//-- there is no llSetLocalPos, this adds the functionality
//-- to match llGetLocalPos() in a child prim
fSetLocalPos( vector vPosOffset ){
  llSetPos( llGetRootPosition() + vPosOffset );
}
//-- this will move a root prim by the offset, or set the
//-- position of a child prim relative to the root.
</lsl>
|also_functions=
{{LSL DefineRow||[[llGetLocalPos]]|Gets the child prims position relative to the root}}
{{LSL DefineRow||[[llGetPos]]|Gets the prims global position}}
{{LSL DefineRow||[[llSetPos]]|Sets the prims global position}}
|also_tests
|also_tests
|also_events
|also_events

Revision as of 16:38, 19 February 2008

Summary

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

Returns a vector that is the region position of the root object of the object script is attached to

Examples

<lsl> default{

 touch_start( integer vIntTouched ){
   string vStrMessage = "The prim with this scipt is ";
   if (llGetPos() != llGetRootPosition()){
     vStrMessage += "NOT ";
   }
   llSay( PUBLIC_CHANNEL, vStrMessage + "centered on the root prim." );
 }

}

</lsl>

Useful Snippets

<lsl> //-- there is no llSetLocalPos, this adds the functionality //-- to match llGetLocalPos() in a child prim fSetLocalPos( vector vPosOffset ){

 llSetPos( llGetRootPosition() + vPosOffset );

} //-- this will move a root prim by the offset, or set the //-- position of a child prim relative to the root. </lsl>

See Also

Functions

•  llGetLocalPos Gets the child prims position relative to the root
•  llGetPos Gets the prims global position
•  llSetPos Sets the prims global position

Deep Notes

Signature

function vector llGetRootPosition();