Difference between revisions of "LlGetRootPosition"

From Second Life Wiki
Jump to navigation Jump to search
 
m (<lsl> tag to <source>)
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{LSLFunctionAll|func_id=268|func_sleep=0.0|func_energy=10.0|func=llGetRootPosition|return_type=vector|func_footnote=Gets the global position of the root object of the object script is attached to|return_text|spec|caveats|examples|helpers|related|also|notes}}[[Category:LSL_Functions]][[Category:LSL_Stub]]
{{LSL_Function
|func_id=268|func_sleep=0.0|func_energy=10.0
|func=llGetRootPosition|return_type=vector
|func_footnote
|func_desc
|return_text=that is the [[Viewer coordinate frames#Region|region]] position of the root object of the object script is attached to
|spec
|caveats
|constants
|examples=
<source lang="lsl2">
default{
  touch_start( integer vIntTouched ){
    string vStrMessage = "The prim with this script is ";
    if (llGetPos() != llGetRootPosition()){
      vStrMessage += "NOT ";
    }
    llSay( PUBLIC_CHANNEL, vStrMessage + "centered on the root prim." );
  }
}
</source>
|helpers=
<source lang="lsl2">
//-- 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.
</source>
|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_events
|also_articles
|notes
|cat1=Movement
|cat2=Prim
|cat3
|cat4
}}

Latest revision as of 02:48, 22 January 2015

Summary

Function: vector llGetRootPosition( );

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

Examples

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

Useful Snippets

//-- 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.

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

Search JIRA for related Issues

Signature

function vector llGetRootPosition();