OsLinkParticleSystem

From OpenSimulator

Revision as of 10:20, 31 December 2023 by Manni (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
osLinkParticleSystem(LSL_Integer linknumber, LSL_List rules)
No descriptions provided
Threat Level This function does not do a threat level check
Permissions none
Extra Delay No function delay specified
Example(s)
float burst_radius = llFrand(5.0);  // Random burst radius
float angle_begin  = PI_BY_TWO;  // starting angle
float angle_end    = PI_BY_TWO;  // ending angle
key   target       = "";
 
vector  start_color = <llFrand(1.0),llFrand(1.0),llFrand(1.0)>;  // Random initial color
vector  end_color   = <llFrand(1.0),llFrand(1.0),llFrand(1.0)>;  // Random final color
float   start_alpha = llFrand(1.0);  // Random initial alpha
float   end_alpha   = llFrand(0.1);  // Random final alpha
vector  start_scale = <llFrand(1.0),llFrand(1.0),llFrand(1.0)>;  // Random initial scale
vector  end_scale   = <llFrand(1.0),llFrand(1.0),llFrand(1.0)>;  // Random final scale
key     texture     = "b4ba225c-373f-446d-9f7e-6cb7b5cf9b3d";
float   start_glow  = llFrand(1.0);  // Random initial glow
float   end_glow    = llFrand(0.0);  // Random final glow
 
float   source_max_age       = 0.0;
float   particle_max_age     = llFrand(5.0);  // Random maximum age of individual particles
float   burst_rate           = llFrand(0.1);  // Random rate of particle bursts
integer burst_particle_count = (integer) llFrand(5.0);  // Random number of particles in each burst
 
vector  acceleration = <llFrand(1.0),llFrand(1.0),llFrand(1.0)>;  // Random acceleration vector
vector  omega        = <llFrand(1.0),llFrand(1.0),llFrand(1.0)>;  // Random angular velocity vector
float   speed_min    = llFrand(1.0);  // Random minimum speed of particles
float   speed_max    = llFrand(5.0);  // Random maximum speed of particles
 
Particles()
{
    osLinkParticleSystem(
        llGetLinkNumber(), // LSL_Integer linknumber of the object (The link number of the object goes here!!!)
        [
            //System Behaviour
            PSYS_PART_FLAGS,
            //PSYS_PART_BOUNCE_MASK
            PSYS_PART_EMISSIVE_MASK
            //| PSYS_PART_FOLLOW_SRC_MASK
            | PSYS_PART_FOLLOW_VELOCITY_MASK
            | PSYS_PART_INTERP_COLOR_MASK
            | PSYS_PART_INTERP_SCALE_MASK
            //| PSYS_PART_RIBBON_MASK
            //| PSYS_PART_TARGET_LINEAR_MASK
            //| PSYS_PART_TARGET_POS_MASK
            //| PSYS_PART_WIND_MASK
            ,
 
            //System Presentation
            PSYS_SRC_PATTERN,
            //PSYS_SRC_PATTERN_ANGLE
            //PSYS_SRC_PATTERN_ANGLE_CONE
            //PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY
            PSYS_SRC_PATTERN_DROP
            //PSYS_SRC_PATTERN_EXPLODE
            ,
 
            // Set various particle system settings
            PSYS_SRC_BURST_RADIUS, burst_radius,
            //PSYS_SRC_INNERANGLE, angle_begin,     //Either or
            //PSYS_SRC_OUTERANGLE, angle_end,
            PSYS_SRC_ANGLE_BEGIN,  angle_begin,     //Either or
            PSYS_SRC_ANGLE_END,    angle_end,
            PSYS_SRC_TARGET_KEY,   target,
 
            // Particle Appearance
            PSYS_PART_START_COLOR, start_color,
            PSYS_PART_END_COLOR,   end_color,
            PSYS_PART_START_ALPHA, start_alpha,
            PSYS_PART_END_ALPHA,   end_alpha,
            PSYS_PART_START_SCALE, start_scale,
            PSYS_PART_END_SCALE,   end_scale,
            PSYS_SRC_TEXTURE,      texture,
            PSYS_PART_START_GLOW,  start_glow,
            PSYS_PART_END_GLOW,    end_glow,
 
            //Particle Blending
            PSYS_PART_BLEND_FUNC_SOURCE,
            //PSYS_PART_BF_ONE
            //PSYS_PART_BF_ZERO
            //PSYS_PART_BF_DEST_COLOR
            //PSYS_PART_BF_SOURCE_COLOR
            //PSYS_PART_BF_ONE_MINUS_DEST_COLOR
            //PSYS_PART_BF_ONE_MINUS_SOURCE_COLOR
            PSYS_PART_BF_SOURCE_ALPHA
            //PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA
            ,
            PSYS_PART_BLEND_FUNC_DEST,
            //PSYS_PART_BF_ONE
            //PSYS_PART_BF_ZERO
            //PSYS_PART_BF_DEST_COLOR
            //PSYS_PART_BF_SOURCE_COLOR
            //PSYS_PART_BF_ONE_MINUS_DEST_COLOR
            //PSYS_PART_BF_ONE_MINUS_SOURCE_COLOR
            //PSYS_PART_BF_SOURCE_ALPHA
            PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA
            ,
 
            // Particle Flow
            PSYS_SRC_MAX_AGE,          source_max_age,
            PSYS_PART_MAX_AGE,         particle_max_age,
            PSYS_SRC_BURST_RATE,       burst_rate,
            PSYS_SRC_BURST_PART_COUNT, burst_particle_count,
 
            // Particle Motion
            PSYS_SRC_ACCEL,           acceleration,
            PSYS_SRC_OMEGA,           omega,
            PSYS_SRC_BURST_SPEED_MIN, speed_min,
            PSYS_SRC_BURST_SPEED_MAX, speed_max
        ]
    );
}
 
default
{
    state_entry()
    {
        Particles();
    }
 
    touch_start(integer total_number)
    {
        // When touched, reinitialize the particle system with new random parameters
        llResetScript();
    }
}


See Also

  • Test
Personal tools
General
About This Wiki