llSetLocalRot

From Second Life Wiki
Revision as of 13:32, 3 January 2016 by Nava Muni (talk | contribs) (Cleaned up the text ever so slightly and added a bit of clarify text/links.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Summary

Function: llSetLocalRot( rotation rot );
0.2 Forced Delay
10.0 Energy

Sets the rotation of a child prim relative to the root prim

• rotation rot

Caveats

  • This function causes the script to sleep for 0.2 seconds.

Examples

Drop this script into a child prim to rotate it in 1 degree increments on each touch. <source lang="lsl2">rotation rot_xyzs;

default {

   state_entry()
   {
       vector xyz_angles = <0,1.0,0>; // This defines a 1 degree change on the Y axis
       vector angles_in_radians = xyz_angles*DEG_TO_RAD; // Change to radians
       rot_xyzs = llEuler2Rot(angles_in_radians); // Convert to a rotation
   }

   touch_start(integer s)
   {
       llSetLocalRot(llGetLocalRot()*rot_xyzs); // Apply the increment rotation to the prim's current rotation ...

   }
}</source>

Useful Snippets

<source lang="lsl2">//-- this is an equivalent call from any prim in the same link set llSetLinkPrimitiveParamsFast( target_prim, [PRIM_ROT_LOCAL, rot] ); //-- where "target_prim" is the link number of the prim you want to set the local rotation of</source>

Deep Notes

Signature

function void llSetLocalRot( rotation rot );

Haiku

Carousel horses
Race, ever facing forward.
Turn without turning.