Friday, October 7, 2011

Second Life: Clothing - Animated Clothes via Prims and Scripts

Wearing Animated Gifs

Unfortunately, wearing animated gifs isn't as simple as uploading it and wearing it as a texture. However, you can apply textures to prims/sculpties in which you can dictate movement through scripts. In this case, we want our texture to be in constant movement of all the layers it takes to look animated.

Say we want to use this which I named 'crazy colors':


Download the GIF 2 SL Animated Texture Program here (Windows only). Open up the program and 'Load Gif', select your image, and then click 'Output'. From there it would separate all the frames into one jpeg file:


It, to quote: "automatically outputs the number of frames horizontally, vertically and the frames per second on the name of the final image for ease of use with a supplied free script on the site. Upload the image, toss the texture into a prim, add the script and it works."

So along with the output, the image name also includes the numbers you would like to plug into the provided script to make it move horizontally, vertically, etc. In this case: 5, 2, and 10.

Now, let's go into Second Life and rez a prim. Since I have already have a sculpty in mind, any shape will do. To bring in your sculpty, go to Object and in the first dropdown, select "Sculpted" and select your customized scultpy in the 'Texture' box. In this case, I want to have this animated gif as a sort of hat so I have a hollow shaped one.




From there, go to 'Texture' and select our outputted image within the 'Texture' box. Now we have our desired choice of attire with the image. Now to make in animated.




Click on the 'Content' > 'New Script'. Double click on the New Script we have created and replace all the coding with the following:

integer XXX = 3; // Change this to the number of frames up and down
integer YYY = 2; // Change this to the number of frames across
float rate = 8.0;// change this to the number of frames per second
default
{
state_entry()
{
llSetTextureAnim(ANIM_ON | LOOP, ALL_SIDES,XXX,YYY,0,0,rate );
}
}


so my coding looked like:

integer XXX = 3; // 5
integer YYY = 2; // 2
float rate = 8.0;// 10
default
{
state_entry()
{
llSetTextureAnim(ANIM_ON | LOOP, ALL_SIDES,XXX,YYY,0,0,rate );
}
}


And now our prim is animated. Now attach it to whereever you like. Since this was intended to be a hat, I had it attached to the Head > Skull.


Hoorah!






No comments:

Post a Comment