Jump to content

as flexi wing flap - need help


Scout Kestrel
 Share

Recommended Posts

Does any one here have experience with the "as flexi wing flap" script? It uses a cycle of gravity changes to move a flexi child prims up and down as if it were a wing in flight. I am building a pair of wings (two child prims linked to a center root prim) in a standalone Opensimulator grid and can't get the script to work. I'm afraid I'm still not too experienced with scripts, although I'm learning.

I named both child prims WING per the instructions. I've tried inserting the script into both child prims only, into the root prim only, and into all three prims. All that happens is that sometimes there is some temporary twitching of the child prims (if the prims are rotated just right) but they rotate in the wrong direction, left-right instead of up-down.

I've tried different flexi settings. The prims are sized at 0.01, 2.0, 1.0. (and I 've tried switching them around). I get the twitching when I rotate the Y-axis to 300 or higher. Softness is 3.0. Other settings I've tried different combinations. I set the wind strength to no wind in the Opensim default .ini file.

Do I need a second script to trigger them, like a poseball master-slave would?

Here is the script:

---------------------------------------------------------------------------------------------------------------------

/*
  Change the gravity settings on flexi child prims named "WING"
  each second to simulate flapping.
*/
 
// Gravity settings for the flaps
float UP = 1.0;
float DOWN = -1.0;
float MID = 0.0;
// Looping order of the flaps
list FLAPS = [ UP, DOWN, UP, DOWN, UP, DOWN, MID, MID, MID, MID ];
// internal values
integer current_flap = 0;
list WingIDs = [];
 
list LinkedList(string Needle) {
    list Needles;
    integer Hay = 1;
    integer Stacks = llGetNumberOfPrims();
    for(; Hay <= Stacks; ++Hay ) if(llGetLinkName(Hay) == Needle) Needles += Hay;
    return Needles;
}
 
default
{
    state_entry() {
        WingIDs = LinkedList( "WING" );
        llSetTimerEvent( 1.0 );
    }
 
    timer() {
        if ( current_flap >= llGetListLength(FLAPS) ) current_flap = 0;
 
        integer x = llGetListLength(WingIDs);
        integer y = 0;
        for ( ; y < x; ++y )
        {
            llSetLinkPrimitiveParamsFast( llList2Integer( WingIDs, y ),
                                          [PRIM_FLEXIBLE, TRUE, 1,
                                          llList2Integer(FLAPS, current_flap),
                                          0.0, 0.0, 1.0 , <0, 0, 0>]);
        }
 
        ++current_flap;
    }
}

---------------------------------------------------------------------------------------------------------------------

Link to comment
Share on other sites

In OpenSim I forgot to turn the wing prims 90 degrees so that the flexi ends would be affected by gravity. The script looks like it is working the same as in SL now.  The changes neede were very small, only to move the assignment to FLAPS:

/*  Change the gravity settings on flexi child prims named "WING"  each second to simulate flapping.*/ // Gravity settings for the flapsfloat UP = 1.0;float DOWN = -1.0;float MID = 0.0;list FLAPS;// internal valuesinteger current_flap = 0;list WingIDs = []; list LinkedList(string Needle) {    list Needles;    integer Hay = 1;    integer Stacks = llGetNumberOfPrims();    for(; Hay <= Stacks; ++Hay ) if(llGetLinkName(Hay) == Needle) Needles += Hay;    return Needles;} default{    state_entry() {        // Looping order of the flaps        FLAPS = [ UP, DOWN, UP, DOWN, UP, DOWN, MID, MID, MID, MID ];        WingIDs = LinkedList( "WING" );        llSetTimerEvent( 1.0 );    }     timer() {        if ( current_flap >= llGetListLength(FLAPS) ) current_flap = 0;         integer x = llGetListLength(WingIDs);        integer y = 0;        for ( ; y < x; ++y )        {            llSetLinkPrimitiveParamsFast( llList2Integer( WingIDs, y ),                                          [PRIM_FLEXIBLE, TRUE, 1,                                          llList2Integer(FLAPS, current_flap),                                          0.0, 0.0, 1.0 , <0, 0, 0>]);        }         ++current_flap;    }}

 

 
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...