Difference between revisions of "AS Flexi Wing Flap"
Jump to navigation
Jump to search
Silent Mole (talk | contribs) (wing flap) |
m (<source lang="lsl2">) |
||
Line 1: | Line 1: | ||
< | <source lang="lsl2"> | ||
/* | /* | ||
Change the gravity settings on flexi child prims named "WING" | Change the gravity settings on flexi child prims named "WING" | ||
Line 47: | Line 47: | ||
} | } | ||
</ | </source> |
Latest revision as of 18:42, 10 January 2016
/*
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;
}
}