Script Generator de Particule

Buna! Multi dintre voi sunteti fie agasati fie placut impresionati de sistemul de particule din SL. De la mici luminite , la inimioare care leviteaza, la ploaie, ninsoare etc, toate sunt generate printr-un script de particule. Pentru a obtine efectul dorit este necesar timp si rabdare in a testa posibilele valori introduse.

Deoarece mi-ar lua prea mult sa explic fiecare paramentru in parte va procur lista lor aici. Pentru a va usura munca si a nu scrie voi codul va puteti genera un sistem de particule de aici.

In cele ce urmeaza va voi prezenta pe scurt un astfel de script:

// Flaguri : setati pe TRUE(da) daca vreti sa functioneze, altfel FALSE(nu)
integer glow = TRUE;            // Stralucire
integer bounce = FALSE;          // Sa sara particulele la contact cu obiecte
integer interpColor = TRUE;     // Culoare interpolata?
integer interpSize = TRUE;      // Marime interpolata?
integer wind = TRUE;           // Vantul afecteaza particulele?
integer followSource = TRUE;    // Urmaresc particulele sursa?
integer followVel = TRUE;       // Urmaresc viteza sursei?

// Trebyuie ales un pattern de emitere, cele existente sunt:
// PSYS_SRC_PATTERN_EXPLODE
// PSYS_SRC_PATTERN_DROP
// PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY
// PSYS_SRC_PATTERN_ANGLE_CONE
// PSYS_SRC_PATTERN_ANGLE
integer pattern = PSYS_SRC_PATTERN_EXPLODE; //am ales explode pentru a crea efectul ca 
                                           //ele pleaca din sursa

// Alegeti un target, in cazul de fata am ales creatorul
key target = "self";

// Parametrii
float age = 1;                  // Viata fiecarei particule
float maxSpeed = 1;            // Viteza maxima
float minSpeed = 1;            // Viteza minima
string texture = "";           // Textura : fie puneti UUID-ul ei (click dreapta pe ea 
                               //si Copy Asset UUID) fie puneti textura in contentul 
                               //primului si puneti aici numele ei
float startAlpha = 1;           // Valoarea de start a transparentei (1=opac, 
                                //0 =complet transparent)
float endAlpha = 0.1;           // Valorea de sfarsit a transparentei
vector startColor = <0,1,0>;    // Culoare de start a particulelor
vector endColor = <1,0,0>;      // Culoare de sfarsit a particulelor (Se foloseste daca
                                // interpColor este TRUE)
vector startSize = <1,1,1>;     // Marimea de start a particulelor
vector endSize = <1,0,1>;       // Marimea de sfarsit a particulelor (Se foloseste daca
                                // interpSize este TRUE)
vector push = <0,0,0>;          // Forta de impingere a particulelor (pentru arme)

// Parametrii de sistem
float rate = 1.5;            // Cat de rapid se genereaza particule
float radius = 1;          // raza de emitere
integer count = 1;        // cate particule se emit
float outerAngle = 1.54;    // ungiul exterior
float innerAngle = 1.55;    // unghi interior
vector omega = <0,0,0>;    // unghiul de rotatie in jurul sursei
float life = 0;             // Timpul in secunde de delay ca sursa sa creeze particule

/////-------------------------------------------------------------
////Ce urmeaza mai jos e cod standard si poate ramane nemodificat
////--------------------------------------------------------------
integer flags;
list sys;

updateParticles()
{
    flags = 0;
    if (target == "owner") target = llGetOwner();
    if (target == "self") target = llGetKey();
    if (glow) flags = flags | PSYS_PART_EMISSIVE_MASK;
    if (bounce) flags = flags | PSYS_PART_BOUNCE_MASK;
    if (interpColor) flags = flags | PSYS_PART_INTERP_COLOR_MASK;
    if (interpSize) flags = flags | PSYS_PART_INTERP_SCALE_MASK;
    if (wind) flags = flags | PSYS_PART_WIND_MASK;
    if (followSource) flags = flags | PSYS_PART_FOLLOW_SRC_MASK;
    if (followVel) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK;
    if (target != "") flags = flags | PSYS_PART_TARGET_POS_MASK;
    sys = [  PSYS_PART_MAX_AGE,age,
             PSYS_PART_FLAGS,flags,
             PSYS_PART_START_COLOR, startColor,
             PSYS_PART_END_COLOR, endColor,
             PSYS_PART_START_SCALE,startSize,
             PSYS_PART_END_SCALE,endSize,
             PSYS_SRC_PATTERN, pattern,
             PSYS_SRC_BURST_RATE,rate,
             PSYS_SRC_ACCEL, push,
             PSYS_SRC_BURST_PART_COUNT,count,
             PSYS_SRC_BURST_RADIUS,radius,
             PSYS_SRC_BURST_SPEED_MIN,minSpeed,
             PSYS_SRC_BURST_SPEED_MAX,maxSpeed,
             PSYS_SRC_TARGET_KEY,target,
             PSYS_SRC_ANGLE_BEGIN,innerAngle,
             PSYS_SRC_ANGLE_END,outerAngle,
             PSYS_SRC_OMEGA, omega,
             PSYS_SRC_MAX_AGE, life,
             PSYS_SRC_TEXTURE, texture,
             PSYS_PART_START_ALPHA, startAlpha,
             PSYS_PART_END_ALPHA, endAlpha
        ];

    llParticleSystem(sys);
}

default
{
    state_entry()
    {
        updateParticles();
    }
}

Have Fun in SL!

Advertisement

, , , , ,

  1. #1 by thruraspberryseyes on April 9, 2011 - 19:48

    In loc de P.S. Anumiti oameni (adica eu :D :D ) nu suporta particulele! In special in locurile laggy. Si s-ar putea sa va treziti pe “mute” sau “block”.

  2. #3 by thruraspberryseyes on April 9, 2011 - 19:54

    Hai fie……la tine treaca-mearga…te salveaza pilele. Da’ la restu nu garantez :P

    • #4 by Diana Lanfier on April 9, 2011 - 19:56

      Pfiu…noroc cu pilele… :P

      P.S. Maine sigur te vad cu inimioare si fluturasi dupa tine :) )))

  3. #5 by thruraspberryseyes on April 9, 2011 - 20:45

    LOOOOL! Shhh!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.