llSetLocalRot
void llSetLocalRot(rotation Rotation)Sets the rotation of a child prim relative to the root prim.
Parameters
-
Rotation(rotation)
Drop this script into a child prim to rotate it in 1 degree increments on each touch:
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 }}Alternative Approach
Section titled “Alternative Approach”This is an equivalent call from any prim in the same link set:
//-- where "target_prim" is the link number of the prim you want to set the local rotation ofllSetLinkPrimitiveParamsFast( target_prim, [PRIM_ROT_LOCAL, rot] );