LlSetRot

De DigiWiki.

Drop this script in a prim to have it rotate in 1 degree increments

rotation rot_xyzq;
 
default
{
    state_entry()
    {
        vector xyz_angles = <0,1.0,0>; // This is to define a 1 degree change
        vector angles_in_radians = xyz_angles*DEG_TO_RAD; // Change to Radians
        rot_xyzq = llEuler2Rot(angles_in_radians); // Change to a Rotation
    }
 
    touch_start(integer s)
    {
        llSetRot(llGetRot()*rot_xyzq); //Do the Rotation...
 
    }
}

Useful Snippets

//-- These correctly sets a global rotation for the root prim in all scenarios
llSetLocalRot( rot )
llSetPrimitiveParams( [PRIM_ROT_LOCAL, rot] )
 
//-- These correctly sets a global rotation for a child prim in all scenarios
llSetLocalRot( rot * llList2Rot( llGetLinkPrimitiveParams( LINK_ROOT, [PRIM_ROT_LOCAL] ), 0 ) )
llSetPrimitiveParams( [PRIM_ROT_LOCAL, rot * llList2Rot( llGetLinkPrimitiveParams( LINK_ROOT, [PRIM_ROT_LOCAL] ), 0 )] )
Outils personnels
  • Cette page a été consultée 611 fois.
donate
Google Ads