Jump to content

Flexi Wing Script help


KayKendall
 Share

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

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

Recommended Posts

I have searched for help on this script and found one article but it didn't really help much. I am trying to create a bird like object with flexi wings and have them flap with the AS Flexi Wing script below. I created two prims as boxes and flatened them then linked them to a cylinder in the middle. Using Edit linked I set each flat prim to Flexible and named them WING (I did not use the quotation marks....Should I have?). I then added the script to the Root and nothing happened. I tried playing with the settings a bit but to no avail. Is there something I missed or did wrong? Should i have zeroed out the settings in the child prims and let the script call them? Any help would be great!

TIA

Kay

/* 
  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

At first sight, that looks as if it should work.   

Put the following debug line in, just after  

 WingIDs = LinkedList( "WING" );
llOwnerSay("WingIDs are: "+llList2CSV(WingIDs);

Best to start by making sure it does, in fact,  know what child prims you want to affect.

Also, I am not sure if this makes any diifference, but it might be what's causing the problem and doing it my way can't hurt.

Rather than populating list FLAPS before the script starts, do this:

float UP = 1.0;float DOWN = -1.0;float MID = 0.0;
list FLAPS;//....
//and so on
//.
state_entry()
{ FLAPS = [ UP, DOWN, UP, DOWN, UP, DOWN, MID, MID, MID, MID ];
WingIds = LinkedList("WING");
//and so on
}

 

Link to comment
Share on other sites

I can't get in-world now to test but I'd suggest checking two things. First, make sure the script is running (the "Running" checkbox is checked), and second the boxes were "flattened" -- but not on the Z dimension, right? (If they have no Z extent, they'd have no length along which to flex.)

Link to comment
Share on other sites

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