Jump to content

Help with a mesh head facial animation Script!


Contraries
 Share

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

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

Recommended Posts

Hey guys, i been searching for months for a solution to my problem and i have yet to find a good explanation and walkthrough of how to make a script to change facial animations on a mesh head. Let me explain a bit. I made a mesh head and i want different facial animations for it. I want each animation to play and stop with a click of a button. Say for instance some of the mesh heads that are on the market now. You can click a button on the hud and on the head the facial expression changes. I want that for my head. I know it would in tell an alpha script but how would i go about getting the alpha to work with the hud and the head and so on and so forth?

Link to comment
Share on other sites

I think I understand what you're asking. Currently, mesh heads and hands can't be animated in the way that the sl avatar can have different expressions and finger positions. They use seperate texture faces or links for each expression or hand position. The hud communicates which expression or finger position is chosen, and the head or hand will apply 100% alpha to the appropriate texture face/link, and 0% to the others. The mesh face won't move in the way that you see the SL avatar face move for each emoji, unless it is made to simulate it, wich would require several layers for each frame of the animation

I haven't tested it, I think it's just an idea. llGetAnimationList returns a list of animation UUIDS that the avatar is playing. I suppose you could search that list for the uuids of the internal expressions, then communicate the appropriate expression for the mesh to change to,  but I doubt that would work for animations that are uploaded and have those expressions applied.

Link to comment
Share on other sites

im going more along the lines of making different mesh heads with different facial exppressions on each then somehow linking them and doing the transparent and non transparent options for the heads to show a different head with a click of a button and hide the other heads with the same click. Do you know any script for that?

Link to comment
Share on other sites

here's a pair of scripts I worked up real quick. Keep in mind they don't take into account for coloring set on seperate faces for say, tattoos or makeup.

I rezzed a cube, changed the color, and the name, shift drag, new color and name, etc. Link them together. Create new script. Shift drag link set.

Copy 1st script into the script in one of the link sets.

Copy 2nd script into the script in the other link set.

click a cube in the set with the 1st script. The second link set should show only the cube that matches the one just clicked. Click another cube in the first set, the second set should change to match again.

 

default{    state_entry()    {        //llSay(0, "Hello, Avatar!");    }    touch_start(integer total_number)    {        integer link = llDetectedLinkNumber(0);        string name = llGetLinkName(link);        llSay(-500, name);    }}
list names;list links;list colors;integer len;default{    state_entry()    {        integer numprims = llGetNumberOfPrims();        integer i;        for(i = 1;i <= numprims; i++)        {            list linkcolor = llGetLinkPrimitiveParams(i,[PRIM_COLOR,0]);            vector color  = llList2Vector(linkcolor,0);            string name = llGetLinkName(i);            names += name;            links += i;            colors += color;        }        len  = llGetListLength(links);        llListen(-500,"","","");    }        listen(integer chan, string name, key id, string message)    {        if(llGetOwnerKey(id) == llGetOwner())        {            integer idx = llListFindList(names, [message]);            list params = [PRIM_LINK_TARGET,llList2Integer(links,idx),PRIM_COLOR,ALL_SIDES,llList2Vector(colors, idx),1.0];            integer i;            for(i = 0; i < len;i++)            {                integer linknum = llList2Integer(links, i);                if(i !=idx)                {                    vector color = llList2Vector(colors,i);                    params += [PRIM_LINK_TARGET,linknum, PRIM_COLOR,ALL_SIDES,color,0.0];                }            }            llSetLinkPrimitiveParamsFast(LINK_SET,params);        }    }}
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2825 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...