Jump to content

Rotating textures


Cori Sabena
 Share

You are about to reply to a thread that has been inactive for 4780 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I need to have a texture rotated clockwise around the cylinder or cone.  It goes in circles counter clockwise. 

Here is one I used.

float rotate;

default
{
    state_entry()
    {
        rotate = 0;
        llSetTimerEvent(.1);
        
    }

   timer()
   {
       rotate = rotate + .1;
       if (rotate==10.1)
       {
           rotate = 0;
           
        }
        llRotateTexture(rotate,ALL_SIDES);
     }
}

Here is the other one.

default
{
    state_entry()
    {
        llSetTextureAnim(ANIM_ON | LOOP | SMOOTH | ROTATE, ALL_SIDES,
                        1, 1, 1, 1, .01);
    }
}

 

made a lot of changes but never got the look I want.

 

Link to comment
Share on other sites

From the wiki: http://wiki.secondlife.com/wiki/LlSetTextureAnim

 

This slides a texture smoothly in the opposite direction llSetTextureAnim(ANIM_ON | SMOOTH | LOOP , ALL_SIDES, 1, 1, 1.0, 1.0, -1.0);

 

This is a MUCH more efficient way of doing it than your 10-times-per-second timer, which anyway can't go faster than 0.2s because of the llRotateTexture() delay (http://wiki.secondlife.com/wiki/LlRotateTexture)

  • Like 1
Link to comment
Share on other sites

Just as a side note, if you did ever want to use a timer for an application like this, I'd suggest testing for inequalities instead of equality.  That is, test

if(rotate > 10.0)  instead of if(rotate == 10.1)

Most of the time it won't make much difference, especially in a simple script like this, but if you get in the habit of testing an inequality you'll never be tripped up when some internal calculation feeds you 10.0999 or a mysterious glitch overshoots the target and gives you 10.2.

I agree with Peter, though, that llSetTextureAnim is a much better choice here anyway. :smileywink:

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4780 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...