Difference between revisions of "LlGetLocalRot"

From Second Life Wiki
Jump to navigation Jump to search
m (slight correction of example and helper)
m (friends don't let friends truncate floats)
Line 37: Line 37:
|helpers=
|helpers=
<lsl>//-- this is an equivalent call from any prim in the same link set
<lsl>//-- this is an equivalent call from any prim in the same link set
(rotation)((string)llGetLinkPrimitiveParams( target_prim, [PRIM_ROT_LOCAL, rot] ))
llList2Rot(llGetLinkPrimitiveParams( LINK_ROOT, [PRIM_ROT_LOCAL] ), 0)
//-- where "target_prim" is the link number of the prim you want to get the local rotation of</lsl>
//-- where "target_prim" is the link number of the prim you want to get the local rotation of</lsl>
|also_functions=
|also_functions=

Revision as of 07:43, 24 October 2010

Summary

Function: rotation llGetLocalRot( );

Returns the rotation of the prim relative to the root.

If called from the root prim, it returns the objects rotation.

Examples

<lsl>

//--// Door Script - Works At ANY Angle //--//

//-- works in ANY single prim door, linked or un-linked //-- works in muti prim doors NOT linked to a larger structure //-- REQUIREMENTS: a cut root prim. Suggest cube, pathcut start=.125, end=.625 //-- CAVEAT: single prim doors are limited to 5m width

//--// USERS MODIFY HERE v

integer vgIntDoorSwing = 90; //-- use -# to reverse the direction of swing, eg. -90;


rotation gRotDoorSwing;

default{

 state_entry(){
   gRotDoorSwing = llEuler2Rot( <0.0, 0.0, gIntDoorSwing> * DEG_TO_RAD );
 }
 touch_start( integer vIntTouched ){
   llSetLocalRot( (gRotDoorSwing = ZERO_ROTATION / gRotDoorSwing) * llGetLocalRot() );
 }

}

</lsl>

Useful Snippets

<lsl>//-- this is an equivalent call from any prim in the same link set llList2Rot(llGetLinkPrimitiveParams( LINK_ROOT, [PRIM_ROT_LOCAL] ), 0) //-- where "target_prim" is the link number of the prim you want to get the local rotation of</lsl>

Notes

Returns the region relative rotation of the object if called from the root

Deep Notes

Search JIRA for related Issues

Signature

function rotation llGetLocalRot();