Difference between revisions of "LlGetRootRotation"

From Second Life Wiki
Jump to navigation Jump to search
m (friends don't let friends truncate floats)
m (~caveat)
Line 7: Line 7:
|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
* This fuction incorrectly (but usefully) returns the avatars region rotation when called in an attachment, use the following instead:<br><lsl> //-- if called only from the root
llList2Rot(llGetLinkPrimitiveParams( LINK_ROOT, [PRIM_ROT_LOCAL] ), 0)
llGetLocalRot()
//-- works correctly in all scenarios</lsl>
//-- if called from in a linked object
llList2Rot( llGetLinkPrimitiveParams( LINK_ROOT, [PRIM_ROT_LOCAL] ), 0 )
//-- this alternative works correctly in all scenarios
llList2Rot( llGetLinkPrimitiveParams( !!llGetLinkNumber(), [PRIM_ROT_LOCAL] ), 0 )</lsl>
|constants
|constants
|examples=
|examples=

Revision as of 15:30, 26 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 (but usefully) returns the avatars region rotation when called in an attachment, use the following instead:
    <lsl> //-- if called only from the root

llGetLocalRot()

//-- if called from in a linked object

llList2Rot( llGetLinkPrimitiveParams( LINK_ROOT, [PRIM_ROT_LOCAL] ), 0 )

//-- this alternative works correctly in all scenarios

llList2Rot( llGetLinkPrimitiveParams( !!llGetLinkNumber(), [PRIM_ROT_LOCAL] ), 0 )</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();