Difference between revisions of "LlGetRootRotation"

From Second Life Wiki
Jump to: navigation, search
m (+also-functions +caveat + workaround)
Line 6: Line 6:
 
|return_text=that is the [[Viewer coordinate frames#Region|region]] rotation of the root prim of the [[Object|object]].
 
|return_text=that is the [[Viewer coordinate frames#Region|region]] rotation of the root prim of the [[Object|object]].
 
|spec
 
|spec
|caveats
+
|caveats=
 +
* This fuction incorrectly returns the avatars region rotation when called in an attachment, use the following instead:<br><lsl>//-- replaces the llGetRootRotation Function
 +
(rotation)((string)llGetLinkPrimitiveParams( LINK_ROOT, [PRIM_ROT_LOCAL] ))
 +
//-- works correctly in all scenarios</lsl>
 
|constants
 
|constants
 
|examples=
 
|examples=
Line 23: Line 26:
 
|helpers
 
|helpers
 
|also_functions=
 
|also_functions=
{{LSL DefineRow||[[llGetLocalRot]]|}}
 
 
{{LSL DefineRow||[[llGetRot]]|}}
 
{{LSL DefineRow||[[llGetRot]]|}}
 +
{{LSL DefineRow||[[llGetLocalRot]]|}}
 +
{{LSL DefineRow||[[llGetPrimitiveParams]]|}}
 +
{{LSL DefineRow||[[llGetLinkPrimitiveParams]]|}}
 
|also_events
 
|also_events
 
|also_tests
 
|also_tests

Revision as of 02:44, 24 October 2010

Summary

Function: rotation llGetRootRotation( );

Returns a rotation that is the region rotation of the root prim of the object.

Caveats

  • This fuction incorrectly returns the avatars region rotation when called in an attachment, use the following instead:
    <lsl>//-- replaces the llGetRootRotation Function

(rotation)((string)llGetLinkPrimitiveParams( LINK_ROOT, [PRIM_ROT_LOCAL] )) //-- works correctly in all scenarios</lsl>

All Issues ~ Search JIRA for related Bugs

Examples

Simple example to set region rotation of child prim in unattached link set <lsl> default {

 state_entry()
 {
   //Rotate 45 degrees about Y-axis
   rotation globalRot = llEuler2Rot(<0.0, 45.0, 0.0> * DEG_TO_RAD);
   llSetLocalRot(globalRot / llGetRootRotation());
 }

}

</lsl>

Notes

In an attached object, returns region rotation of avatar NOT of the object's root prim. See special cases of rotation.

See Also

Deep Notes

All Issues

~ Search JIRA for related Issues
   Improve accuracy of avatar's visible rotation

Signature

function rotation llGetRootRotation();