Jump to content

Particle Rainbow Effect


DeepusMaximus
 Share

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

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

Recommended Posts

Hi Everyone,

Im pretty new at SL and I just got around to designing some glowrings, which rotate between 4 colours every 1 second. Now I have a streak effect (from my other greenglow rings) which I would like to use but also incorporate this code I found online which should allow for the particles to also rotate between colours.

I managed to get both my code and the code I found online to save nicely and the touch function works great, the particles are released upon touch...but the colours arent changing at all.

Here is what I have so far:

float red;
float green;
float blue;

float loop = 0.;
integer stage = 0;

integer doStuff = FALSE;

particleStuff()
{
         llParticleSystem( [ 
             PSYS_SRC_TEXTURE, "streak3", 
             PSYS_PART_START_SCALE, < 0.2, 0.3, 0 >,  PSYS_PART_END_SCALE, < .01, .01, 0 >, 
             PSYS_PART_START_COLOR, <0.180, 0.800, 0.251>,    PSYS_PART_END_COLOR, <0.004, 0.000, 0.939>, 
             PSYS_PART_START_ALPHA, 0.8,            PSYS_PART_END_ALPHA, 0.4,     
              
             PSYS_SRC_BURST_PART_COUNT, 1, 
             PSYS_SRC_BURST_RATE, 0.000001,
             PSYS_PART_MAX_AGE, 1,
             PSYS_SRC_MAX_AGE, 0.0 , 
 
             PSYS_SRC_PATTERN,   PSYS_SRC_PATTERN_EXPLODE, // DROP, EXPLODE, ANGLE, ANGLE_CONE,
             PSYS_SRC_ANGLE_BEGIN, 0.2,   PSYS_SRC_ANGLE_END, 0.0,  
             PSYS_SRC_BURST_RADIUS, 0.001,
             PSYS_SRC_OMEGA, < 0.00, 0.00, 0.00 >, 
             
             PSYS_SRC_BURST_SPEED_MIN, 0.0025, PSYS_SRC_BURST_SPEED_MAX, .15, 
             PSYS_SRC_ACCEL, < 0.0, 0.0, -0.001 >,  
          // PSYS_SRC_TARGET_KEY, llGetKey(),             
             PSYS_PART_FLAGS, ( 0 // | PSYS_PART_EMISSIVE_MASK        
                                  // | PSYS_PART_BOUNCE_MASK          
                                  // | PSYS_PART_WIND_MASK            
                                  // | PSYS_PART_FOLLOW_VELOCITY_MASK
                                     | PSYS_PART_RIBBON_MASK
                                  // | PSYS_PART_FOLLOW_SRC_MASK     
                                  // | PSYS_PART_INTERP_COLOR_MASK   
                                  // | PSYS_PART_INTERP_SCALE_MASK   
                                  // | PSYS_PART_TARGET_POS_MASK     
                                  // | PSYS_PART_TARGET_LINEAR_MASK    
             ) ] );
 }
 
 colorChange()
{
    if ( stage == 0)
    {
        red = 1.; green = loop; blue = 0.;
    }
    else if ( stage == 1)
    {
        red = 1. - loop; green = 1.; blue = 0.;
    }
    else if ( stage == 2)
    {
        red = 0.; green = 1.; blue = loop;
    }
    else if ( stage == 3)
    {
        red = 0.; green = 1. - loop; blue = 1.;
    }
    else if ( stage == 4)
    {
        red = loop; green = 0.; blue = 1.;
    }
    else if ( stage == 5)
    {
        red = 1.; green = 0.; blue = 1. - loop;
    }
    particleStuff();
}

default
{
    state_entry()
    {
        llParticleSystem([]);
    }

    touch_start(integer total_number)
    {
        doStuff = !doStuff;
        if ( doStuff)
            llSetTimerEvent( .5);
        else
        {
            llParticleSystem([]);
            llSetTimerEvent( .0);
        }
    }

    timer()
    {
        loop += .05;
        if ( loop > 1.01)
        {
            loop = 0.;
            stage++;
            if ( stage > 5)
                stage = 0;
        }
        colorChange();
    }
}

 

Any thoughts? Did I overlook anything?

Much appreciated!

 

Regards,

Nav

Link to comment
Share on other sites

something mebbe like changing ...

 PSYS_PART_START_COLOR, <0.180, 0.800, 0.251>,    PSYS_PART_END_COLOR, <0.004, 0.000, 0.939>, 

into

 PSYS_PART_START_COLOR, <red, green, blue>,    PSYS_PART_END_COLOR, <red, green, blue>, 

Link to comment
Share on other sites

Ok the particles seem to be working now great! but unfortunately the ring themselves stopped rotating colours. This is the script Id been using:

    llSetTextureAnim (ANIM_ON | LOOP, ALL_SIDES, 2, 2, 0, 0, 1.0);

Its fine unless I activate the particles.

I tried incorporating this into the code I pasted up originally, it saves fine, and start off as normal. But stops once the particles are activated by touch.

So my code looks like this as of now:

float red;
float green;
float blue;

float loop = 0.;
integer stage = 0;

integer doStuff = FALSE;

particleStuff()
{
         llParticleSystem( [ 
             PSYS_SRC_TEXTURE, "streak3", 
             PSYS_PART_START_SCALE, < 0.2, 0.3, 0 >,  PSYS_PART_END_SCALE, < .01, .01, 0 >, 
             PSYS_PART_START_COLOR, <red, green, blue>,    PSYS_PART_END_COLOR, <red, green, blue>, 
             PSYS_PART_START_ALPHA, 1.8,            PSYS_PART_END_ALPHA, 0.4,     
              
             PSYS_SRC_BURST_PART_COUNT, 1, 
             PSYS_SRC_BURST_RATE, 0.000001,
             PSYS_PART_MAX_AGE, 1,
             PSYS_SRC_MAX_AGE, 0.0 , 
 
             PSYS_SRC_PATTERN,   PSYS_SRC_PATTERN_EXPLODE, // DROP, EXPLODE, ANGLE, ANGLE_CONE,
             PSYS_SRC_ANGLE_BEGIN, 0.2,   PSYS_SRC_ANGLE_END, 0.0,  
             PSYS_SRC_BURST_RADIUS, 0.001,
             PSYS_SRC_OMEGA, < 0.00, 0.00, 0.00 >, 
             
             PSYS_SRC_BURST_SPEED_MIN, 0.0025, PSYS_SRC_BURST_SPEED_MAX, .15, 
             PSYS_SRC_ACCEL, < 0.0, 0.0, -0.001 >,  
          // PSYS_SRC_TARGET_KEY, llGetKey(),             
             PSYS_PART_FLAGS, ( 0 // | PSYS_PART_EMISSIVE_MASK        
                                  // | PSYS_PART_BOUNCE_MASK          
                                  // | PSYS_PART_WIND_MASK            
                                  // | PSYS_PART_FOLLOW_VELOCITY_MASK
                                     | PSYS_PART_RIBBON_MASK
                                  // | PSYS_PART_FOLLOW_SRC_MASK     
                                  // | PSYS_PART_INTERP_COLOR_MASK   
                                  // | PSYS_PART_INTERP_SCALE_MASK   
                                  // | PSYS_PART_TARGET_POS_MASK     
                                  // | PSYS_PART_TARGET_LINEAR_MASK    
             ) ] );
 }
 
 colorChange()
{
    if ( stage == 0)
    {
        red = 1.; green = loop; blue = 0.800;
    }
    else if ( stage == 1)
    {
        red = 1. - loop; green = 1.; blue = 0.;
    }
    else if ( stage == 2)
    {
        red = 0.; green = 1.; blue = loop;
    }
    else if ( stage == 3)
    {
        red = 0.; green = 1. - loop; blue = 1.;
    }
    else if ( stage == 4)
    {
        red = loop; green = 0.; blue = 1.;
    }
    else if ( stage == 5)
    {
        red = 1.; green = 0.; blue = 1. - loop;
    }
    particleStuff();
    llSetTextureAnim (ANIM_ON | LOOP, ALL_SIDES, 2, 2, 0, 0, 1.0);
    
}

default
{
    state_entry()
    {
    llSetTextureAnim (ANIM_ON | LOOP, ALL_SIDES, 2, 2, 0, 0, 1.0);
        llParticleSystem([]);
    }

    touch_start(integer total_number)
    {
        doStuff = !doStuff;
        if ( doStuff)
            llSetTimerEvent( .5);
        else
        {
          
            llParticleSystem([]);
            llSetTextureAnim (ANIM_ON | LOOP, ALL_SIDES, 2, 2, 0, 0, 1.0);
            llSetTimerEvent( .0);
        }
    }

    timer()
    {
        loop += .05;
        if ( loop > 1.01)
        {
            loop = 0.;
            stage++;
            if ( stage > 5)
                stage = 0;
        }
        colorChange();
                    llSetTextureAnim (ANIM_ON | LOOP, ALL_SIDES, 2, 2, 0, 0, 1.0);
    }
}

Edited by DeepusMaximus
wrong code
Link to comment
Share on other sites

erm, congratz! .. You have found a new bug!

apparently, turning on particles turns off texture anim ?

mebbe someone else can check it :P

 

as a work around, just put the particles in another prim and send it a msg?

Link to comment
Share on other sites

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