Advertisement
worstbull

setTextureAnim - also along Y-axis

Sep 21st, 2014
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. float fSleep = 0.02; //speed
  2. string sTexture = "5baee477-ea6d-bd2e-c213-c99a4393796f"; //put texture key here
  3.  
  4. integer iLink = LINK_THIS; //linknumber
  5. integer iFace = ALL_SIDES; //linkface
  6. float fRotation = 0.0; //texture rotation
  7. vector vRepeats = <1.0, 1.0, 0.0>; //repeats
  8. integer iANIMATE_X = TRUE; //set this to TRUE or FALSE, if you want to animate along the X-axis or the Y axis, according.
  9. integer iDIRECTION_POSITIVE = FALSE; //set this to TRUE or FALSE if you want to swap directions from negative to positive animation-direction, according.
  10. float fStepwidth = 0.01; //jump per animation-frame
  11.  
  12.  
  13.  
  14. float fStep = 0.0; //global variable, don't change
  15. setTextureAnim(string stexture, integer ilink, integer iface, float frotation, vector vrepeats, integer animatex, integer directionpositive, float fstepwidth)
  16. {
  17.     vector vOffset = <fStep, 0.0, 0.0>;
  18.     if (animatex == FALSE)
  19.     {
  20.         vOffset = <0.0, fStep, 0.0>;
  21.     }
  22.     llSetLinkPrimitiveParamsFast(ilink, [ PRIM_TEXTURE, iface, stexture, vrepeats, vOffset, frotation]);
  23.     if (directionpositive)
  24.     {
  25.         fStep = fStep + fstepwidth;
  26.         if (fStep > 1.0)
  27.         {
  28.             fStep = 0.0;
  29.         }
  30.     }
  31.     else
  32.     {
  33.         fStep = fStep - fstepwidth;
  34.         if (fStep < 0.0)
  35.         {
  36.             fStep = 1.0;
  37.         }
  38.     }
  39. }
  40. default
  41. {
  42.     state_entry()
  43.     {
  44.         llSetTimerEvent(fSleep);
  45.     }
  46.     timer()
  47.     {
  48.          setTextureAnim(sTexture, iLink, iFace, fRotation, vRepeats, iANIMATE_X, iDIRECTION_POSITIVE, fStepwidth);
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement