Page 1 of 1

In search of texture change on touch script for mesh

Posted: Sat May 20, 2023 3:59 pm
by Kimm Starr
In search of texture change on touch script for mesh. Not sure if this is possible because I have searched high and low for one with no luck. I created an Elephant Man Animesh and I want people to be able to touch his hood and it turn clear (transparent) to reveal his head. Thanks in advance for any help with this. Willing to pay for the script.

Re: In search of texture change on touch script for mesh

Posted: Sat May 20, 2023 7:29 pm
by Graham Mills
With the proviso that I've never tried this with mesh, I'd guess it's a matter of changing the texture on a particular face using llSetTexture (assuming it's not a linkset)? I guess some animated reveal or dissolve might be appropriate but that's the basics afaik.

Code: Select all

string hoodTexture = "1bw";//names of textures in object inventory
string faceTexture = "2bw";
integer face = 0;// face to be textured

default
{
    on_rez(integer p)
    {
        llSetTexture(hoodTexture, face);
    }
    
    touch_start(integer i)
    {
        if (llDetectedTouchFace(0) == face)
        {
            if (llGetTexture(0) == faceTexture)
            {
                llSetTexture(hoodTexture, face);
            }
            else
            {
                llSetTexture(faceTexture, face);
            }
        }
    }
}

Re: In search of texture change on touch script for mesh

Posted: Sun May 21, 2023 3:13 pm
by Kimm Starr
Thanks so much Graham, I'll give this a try now.

Re: In search of texture change on touch script for mesh

Posted: Tue May 23, 2023 12:34 am
by Luna Lunaria
Let me know if that works Kimm. If not, I have one that I use all the time