Jump to content
Sunbleached

Animate the texture on the specified face

Recommended Posts

Hello! How to make the texture be animated by script from here:  llSetTextureAnim only on one face of the mesh with several materials - faces?

Please, help! This wonderful script used;

integer textureIsBeingAnimated;
 
default
{
    touch_start(integer num_detected)
    {
        if (textureIsBeingAnimated)
            llSetTextureAnim(ANIM_ON | SMOOTH | SCALE | PING_PONG | LOOP, ALL_SIDES, 0, -10, 1.0, .3, 5);     
        else
            llSetTextureAnim(FALSE, ALL_SIDES, 0, 0, 0.0, 0.0, 1.0);     
 
        // toggle back and forth between TRUE (1) and FALSE (0)
        textureIsBeingAnimated = !textureIsBeingAnimated;
    }
}

 

Edited by Sunbleached
  • Thanks 1

Share this post


Link to post
Share on other sites

Your first, quite reliable source of information about LSL functions is the LSL wiki, in which you will find

771f29a698ac82381ff52774057c196f.png

So... specify the face number instead of ALL_SIDES

Edited by Rolig Loon
  • Like 1

Share this post


Link to post
Share on other sites
10 hours ago, Rolig Loon said:

Your first, quite reliable source of information about LSL functions is the LSL wiki, in which you will find

771f29a698ac82381ff52774057c196f.png

So... specify the face number instead of ALL_SIDES

Yes, thanks! But how? More specifically please? I'm a noob at scripting.
In the beginning it is necessary to specify a line:

"integer face;".

And then what to do? Just replace ALL_SIDES with face number?

Edited by Sunbleached
  • Thanks 1

Share this post


Link to post
Share on other sites

@Rolig Loon

Ok, I got it working! I just put '4' (my face number) instead of ALL_SIDES.

One more question. What if you need to animate on two sides only? Specify them in the same way either through a comma or in parentheses? Is there a difference?

Edited by Sunbleached
  • Thanks 1

Share this post


Link to post
Share on other sites

I believe you can only animate either one or all the faces of a prim, and you can only run one animation on a prim.

To get the effect you're asking about I'd use two identical prims, one set up with the animation on ALL_SIDES and with the unwanted faces transparent, and make the faces on the other prim that correspond to the desired faces of the first prim transparent.

  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, Sunbleached said:

What if you need to animate on two sides only?

Again, read the information in the LSL wiki:

"You can only have one texture animation on a prim

  • Calling llSetTextureAnim more than once on a prim will reset the existing animation."

You cannot animate just TWO faces..  It's ONE face or ALL_SIDES.

  • Thanks 1

Share this post


Link to post
Share on other sites
7 hours ago, Rolig Loon said:

Again, read the information in the LSL wiki:

"You can only have one texture animation on a prim

  • Calling llSetTextureAnim more than once on a prim will reset the existing animation."

You cannot animate just TWO faces..  It's ONE face or ALL_SIDES.

Thanks a lot!

Edited by Sunbleached
  • Thanks 1

Share this post


Link to post
Share on other sites
On 10/12/2017 at 6:28 PM, Rolig Loon said:

Your first, quite reliable source of information about LSL functions is the LSL wiki, in which you will find

771f29a698ac82381ff52774057c196f.png

So... specify the face number instead of ALL_SIDES

care to be more specific??  iv tried face_2 , face 2,face2,2,two

Share this post


Link to post
Share on other sites

If you are trying to animate face 2, specify 2.  In LSL, whenever you are asked to provide a face number, the syntax is expecting an integer.  Hence, the wording in the function description:

llSetTextureAnim( integer mode, integer face, integer sizex, integer sizey, float start, float length, float rate );

 

 

Share this post


Link to post
Share on other sites
20 minutes ago, Rolig Loon said:

If you are trying to animate face 2, specify 2.  In LSL, whenever you are asked to provide a face number, the syntax is expecting an integer.  Hence, the wording in the function description:

llSetTextureAnim( integer mode, integer face, integer sizex, integer sizey, float start, float length, float rate );

 

 

        llSetTextureAnim(ANIM_ON | SMOOTH | LOOP | PING_PONG | ROTATE,2, 0, 0.01, .01, 0.01 ,0.005);

nore         llSetTextureAnim(ANIM_ON | SMOOTH | LOOP | PING_PONG | ROTATE, 2, 0, 0.01, .01, 0.01 ,0.005);

seem to be ding itfor me i get an error .. function call mismatches type or number or arguments 

Share this post


Link to post
Share on other sites

The problem isn't the face number.

llSetTextureAnim(ANIM_ON | SMOOTH | LOOP | PING_PONG | ROTATE,2, 0, 0.01, .01, 0.01 ,0.005);

The syntax is expecting you to use an integer value for sizey

EDIT:  As a secondary but important issue, notice that it make no sense to let either sizex or sizey equal zero.

 

Edited by Rolig Loon

Share this post


Link to post
Share on other sites
Just now, Rolig Loon said:

The problem isn't the face number.

llSetTextureAnim(ANIM_ON | SMOOTH | LOOP | PING_PONG | ROTATE,2, 0, 0.01, .01, 0.01 ,0.005);

The syntax is expecting you to use an integer value for sizey.

 

so what do it do?? i should mention im using a script that works fine for all faces and only changed the all_faces bit

Share this post


Link to post
Share on other sites
1 minute ago, tabletopfreak Toocool said:

i dont know what integer sizey means

Again, read the specification:

• integer sizex horizontal frames (ignored for ROTATE and SCALE)  
• integer sizey vertical frames (ignored for ROTATE and SCALE)

Share this post


Link to post
Share on other sites

ohh size y not "sizey" i had no idea what "sizey" means i was reading like an odd spelling.. not really self explaining .. now if they used size y THEN THAT would be much more clear to the general public .. i see float rate isnt floatrate  so why size y and x are sizey and sizex .. i dont know.. ok i still dont understand the issue tho.. what does sizey need to be a whole number?

Share this post


Link to post
Share on other sites
1 minute ago, tabletopfreak Toocool said:

what does sizey need to be a whole number?

For three reasons:

1. Sizex and sizey (both defined in the specifications) count the number of frames in the texture that you want to use for the animation.  If your texture has six frames, for example, you need to tell the function whether they are arranged with three frames on the top row and three on the bottom (sizex = 3 and sizey = 2) or two frames on each of three rows (sizex = 2 and sizey = 3).  You obviously cannot ever have zero frames in either direction unless you are trying to tell the script that you've decided not to animate after all.

2. You can't have half of a frame in either direction, or 0.1 of a frame, or 3.1415729 of a frame.  On;ly integers make any sense.

3. More simply, you need an integer because that's what the specification tells you to provide, an integer, not a float

  • Thanks 1

Share this post


Link to post
Share on other sites

sorry if i seemed frustrated.. just felt like we were dancing around the answer.. you know were on a dying platform.. and like if you want the ship to sync slower we have to do what we can to help people who want to be here.. not saying you guys weren't helpful but  ,like fionaleins comment was for what?? it only servers to down someone who is trying to keep this ship afloat 

  • Like 1
  • Confused 1

Share this post


Link to post
Share on other sites
2 minutes ago, Rolig Loon said:

For three reasons:

1. Sizex and sizey (both defined in the specifications) count the number of frames in the texture that you want to use for the animation.  If your texture has six frames, for example, you need to tell the function whether they are arranged with three frames on the top row and three on the bottom (sizex = 3 and sizey = 2) or two frames on each of three rows (sizex = 2 and sizey = 3).  You obviously cannot ever have zero frames in either direction unless you are trying to tell the script that you've decided not to animate after all.

2. You can't have half of a frame in either direction, or 0.1 of a frame, or 3.1415729 of a frame.  On;ly integers make any sense.

3. More simply, you need an integer because that's what the specification tells you to provide, an integer, not a float

ohh thats for like cell images when the animation is like 3 rows and 3 columns our whatever the case may be?

Share this post


Link to post
Share on other sites
Just now, tabletopfreak Toocool said:

ohh thats for like cell images when the animation is like 3 rows and 3 columns our whatever the case may be?

That's exactly what this function is designed for. B|  Using it to animate a texture with only one frame in each direction only makes sense in the trivial case when you are intending to rotate the texture or just offset it gently across the face.  It's usually used to simulate something like an animated GIF.

Share this post


Link to post
Share on other sites
20 minutes ago, tabletopfreak Toocool said:

ohh size y not "sizey" i had no idea what "sizey" means i was reading like an odd spelling.. not really self explaining .. now if they used size y THEN THAT would be much more clear to the general public .. i see float rate isnt floatrate  so why size y and x are sizey and sizex .. i dont know..

Just going back to clear up a misconception .... Take a look at the specification.  Each of the parameters that the function expects is defined by telling you what type of variable to use.  So when the specification says

llSetTextureAnim( integer mode, integer face, integer sizex, integer sizey, float start, float length, float rate );

it is telling you to provide

an integer for the mode,

an integer for the face number,

an integer for the number of frames in the X direction,

an integer for the number of frames in the Y direction,

a float for the frame to start with,

a float for the number of frames in the anim,

and a float for the rate.

As written, each is given a placeholder variable name, which is used in the specification table below it.  Variable names in LSL cannot have blank spaces in them, so they can't use a name like "size x" or "size y".  They might have named them "size_x" or "Xsize" or "SX", but "sizex" and "sizey" work just as well. When you use the function yourself, you may use whatever names you wish -- as long as they don't have spaces in them.  9_9

 

  • Thanks 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...