[recherche] création d un carrillon

Répondre
Partager Rechercher
j'ai créé un carillon bambou avec une ficelle centrale que je voudrai faire bouger avec des mouvements aléatoires afin de percuter les tube de bambou . j'ai essayé de rajouter des attributs de flexibilité avec un peu de vent mais cela ne donne pas le mouvement que je souhaite .Existe-il un script avec des mouvements aléatoires?
merci pour vos réponses
Bon voilà le script; et désolée y a du boulot mais j'ai pas le temps. A vu de nez, je pense que cela devrait marché sur des prims rigides, mais qu'elles auront un mouvement oscillatoire par rapport à leur centre.
Code:
//Scripting by Whinge Languish.  These scripts are NOT for resale.
//They are modifiable so that you can tweak the code and
//experiment, but please do not use them in anything you sell.

//These definite what rotation the ear should be in for each state.
//A tip: edit the ear and adjust the numbers for the rotation until
//it's where you want, then copy them here.
vector Perked   = <183.55, 304.90, .20>;
vector Relaxed  = <181.55, 324.88, 359.25>;
vector Drooped =<177.70, 0.00, 0.00>;

//You will also need to add the state into the listen event.

//The following 2 variables are merely to make the listen work properly
integer l1=0;
integer l2=0;
integer TCHANNEL=137;

rotation currRot;
rotation prevRot;
float wagDelay = 0.015;
float wagAmount = 0.1;
integer tailtwitch = 1;  // rabit: tailtwitch on by default - sexxxy
default
{
    on_rez(integer start_param)
    {
        if(l1!=0)
            llListenRemove(l1);
        if(l2!=0)
            llListenRemove(l2);
        l1=llListen(1,"",llGetOwner(),"");
        l2=llListen(TCHANNEL,"",llGetOwner(),"");
    }
    
    state_entry()
    {
        if(l1!=0)
            llListenRemove(l1);
        if(l2!=0)
            llListenRemove(l2);
        l1=llListen(1,"",llGetOwner(),"");
        l2=llListen(TCHANNEL,"",llGetOwner(),"");
        if (tailtwitch==TRUE)
        {
            llSetTimerEvent(2+llFrand(5));
        }
    }

    listen(integer channel, string name, key id, string msg)
    {
        if (channel==TCHANNEL)
        {
            //If you added another state, you will also have to add it here
            if (msg=="Perked")
            {
                llSetLocalRot(llEuler2Rot(Perked*DEG_TO_RAD));
            }
            else if (msg=="Relaxed")
            {
                llSetLocalRot(llEuler2Rot(Relaxed*DEG_TO_RAD));
            }
            else if (msg=="Drooped")
            {
                llSetLocalRot(llEuler2Rot(Drooped*DEG_TO_RAD));
            }
            else if (msg=="GetAnimState")
            {
                
            }
            else if (msg=="Wag")
            {
                currRot=llGetLocalRot();
                prevRot=llGetLocalRot();
                currRot.x=(currRot.x - ( wagAmount * 1 ));
                currRot.y=(currRot.y + ( wagAmount * 1 ));
                llSetLocalRot(currRot);
                llSleep(wagDelay);
                // The Next Rotations need to be exagerated from home position + 1
                currRot.x=(currRot.x + ( wagAmount * 2 ));
                currRot.y=(currRot.y - ( wagAmount * 2 ));
                llSetLocalRot(currRot);
                llSleep(wagDelay);
                currRot.x=(currRot.x - ( wagAmount * 3 ));
                currRot.y=(currRot.y + ( wagAmount * 3 ));
                llSetLocalRot(currRot);
                llSleep(wagDelay);
                currRot.x=(currRot.x + ( wagAmount * 4 ));
                currRot.y=(currRot.y - ( wagAmount * 4 ));
                llSetLocalRot(currRot);
                llSleep(wagDelay);
                currRot.x=(currRot.x - ( wagAmount * 3 ));
                currRot.y=(currRot.y + ( wagAmount * 3 ));
                llSetLocalRot(currRot);
                llSleep(wagDelay);
                currRot.x=(currRot.x + ( wagAmount * 2 ));
                currRot.y=(currRot.y - ( wagAmount * 2 ));
                llSetLocalRot(currRot);
                llSleep(wagDelay);
                currRot.x=(currRot.x + ( wagAmount * 1 ));
                currRot.y=(currRot.y - ( wagAmount * 1 ));
                llSetLocalRot(currRot);
                llSleep(wagDelay);
                
                // Put everything back the way it was
                llSetLocalRot(prevRot);
            }
        }
        else if (channel==1)
        {
            msg=llToLower(msg);
            if (msg=="tailtwitch on")
            {
                tailtwitch=TRUE;
                llSetTimerEvent(2+llFrand(5));
            }
            else if (msg=="tailtwitch off")
            {
                tailtwitch=FALSE;
                llSetTimerEvent(0);
            }
        }
    }
    
    timer()
    {
        currRot=llGetLocalRot();
        currRot.x=(currRot.x - 0.1);
        currRot.y=(currRot.y - 0.05);
        llSetLocalRot(currRot);
        llSleep(0.1);
        currRot.x=(currRot.x + 0.1);
        currRot.y=(currRot.y + 0.05);
        llSetLocalRot(currRot);
        llSleep(0.1);
        currRot.x=(currRot.x + 0.1);
        currRot.y=(currRot.y + 0.05);
        llSetLocalRot(currRot);
        llSleep(0.1);
        currRot.x=(currRot.x - 0.1);
        currRot.y=(currRot.y - 0.05);
        llSleep(0.1);
        currRot.x=(currRot.x - 0.1);
        currRot.y=(currRot.y - 0.05);
        llSleep(0.1);
        currRot.x=(currRot.x + 0.1);
        currRot.y=(currRot.y + 0.05);
        llSetLocalRot(currRot);
        llSetTimerEvent(2+llFrand(5));
    }
}
Répondre

Connectés sur ce fil

 
1 connecté (0 membre et 1 invité) Afficher la liste détaillée des connectés