User:Dora Gustafson/Replacing llTargetOmega/function

From Second Life Wiki
< User:Dora Gustafson‎ | Replacing llTargetOmega
Revision as of 04:05, 12 August 2014 by Dora Gustafson (talk | contribs) (KeyFramedOmega function)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Replacing llTargetOmega, the function

<lsl> KeyFramedOmega( vector axis, float spinrate) {

   llSetKeyframedMotion( [], []);
   if ( spinrate )
   {
       float v = TWO_PI/3.0;
       if ( spinrate < 0 ) v = -v;
       list L = [llAxisAngle2Rot( axis/llGetRot(), v), v/spinrate];
       llSetKeyframedMotion( L+L+L, [KFM_DATA, KFM_ROTATION, KFM_MODE, KFM_LOOP]);
   }

} </lsl>