In search of texture change on touch script for mesh

Post requests for goods or services
Post Reply
User avatar
Kimm Starr
Posts: 185
Joined: Wed Jan 30, 2019 7:59 pm
Has thanked: 229 times
Been thanked: 315 times

In search of texture change on touch script for mesh

Post 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.
These users thanked the author Kimm Starr for the post:
Ilan Tochner
I'm obsessed with Animesh and soon you will be too!
Graham Mills
Posts: 1286
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1050 times
Been thanked: 1101 times

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

Post 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);
            }
        }
    }
}
These users thanked the author Graham Mills for the post:
Ilan Tochner
User avatar
Kimm Starr
Posts: 185
Joined: Wed Jan 30, 2019 7:59 pm
Has thanked: 229 times
Been thanked: 315 times

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

Post by Kimm Starr »

Thanks so much Graham, I'll give this a try now.
These users thanked the author Kimm Starr for the post:
Graham Mills
I'm obsessed with Animesh and soon you will be too!
User avatar
Luna Lunaria
Posts: 75
Joined: Thu Mar 16, 2017 1:02 am
Has thanked: 34 times
Been thanked: 120 times

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

Post by Luna Lunaria »

Let me know if that works Kimm. If not, I have one that I use all the time
Post Reply