Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float spin_rate = 0.20;
- float roll_rate = 0.00;
- float yaw_rate = 0.00;
- integer LOCAL_AXIS = TRUE;
- string CONTROLLER_ID = "A";
- integer AUTO_START = TRUE;
- rotation adjustment = ZERO_ROTATION;
- integer iStarted = FALSE;
- randomllTargetOmega()
- {
- spin_rate = llFrand(2.0) - 1.0;
- roll_rate = llFrand(2.0) - 1.0;
- yaw_rate = llFrand(2.0) - 1.0;
- llTargetOmega( <roll_rate, yaw_rate, spin_rate>*adjustment, 2.0, 2.0 );
- }
- default
- {
- state_entry()
- {
- llSetTimerEvent(0.1);
- if ( LOCAL_AXIS ) adjustment = llGetRot();
- if ( AUTO_START )
- {
- iStarted = TRUE;
- }
- }
- link_message( integer sibling, integer num, string mesg, key target_key )
- {
- if ( mesg != CONTROLLER_ID )
- {
- return;
- }
- else if ( num == 0 )
- {
- llTargetOmega( <0, 0, 0>, 1.0, 1.0 );
- iStarted = FALSE;
- llSetLocalRot( llGetLocalRot() );
- }
- else if ( num == 1 )
- {
- iStarted = TRUE;
- }
- else
- {
- }
- }
- timer()
- {
- if (iStarted)
- {
- randomllTargetOmega();
- }
- } changed(integer change)
- {
- if (change & CHANGED_LINK)
- {
- if (llGetNumberOfPrims() > 7)
- {
- if ( AUTO_START )
- {
- iStarted = TRUE;
- }
- } else {
- if (iStarted)
- {
- llTargetOmega( <0, 0, 0>, 1.0, 1.0 );
- iStarted = FALSE;
- llSetLocalRot( llGetLocalRot() );
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement