Tuesday, October 12, 2010

Official New York Drivers License Template

Particles (part 3) - Target - Target on sensor

We gave a general overview about the parameters, and we saw how to add textures and patterns.
Now let's take a quick experiment to include a target to our script. The
target (target) can be an avatar or an object: all the particles move towards the target set on the script.

If you followed the small little lesson on how to retrieve your key , can do just a test. Starting with the script
earlier, once you get the key of your avatar, you must first declare it immediately to the opening function Particles ():

key target = "your key "

and enter the key now called "target" in the line ll in ParticleSystem ([....

PSYS_SRC_TARGET_KEY, target ,
- make sure that the flag is set to true: ; integer followTarget = TRUE ;

For clarity, place the script Full:

////////---------------------------------- -------------
Particles () {

key target = " insert your key here";
integer glow = TRUE; ; ;
integer bounce = FALSE;                         
integer interpColor = TRUE ;                    
integer interpSize = TRUE;                      
integer wind = FALSE;                           
integer followSource = FALSE;                 
integer followVel = TRUE;                     
integer followTarget = TRUE;

integer flags;

flags = 0;
 if (glow) flags = flags PSYS_PART_FOLLOW_VELOCITY_MASK;  if (followTarget) flags = flags
PSYS_SRC_BURST_RATE ,0.2,
PSYS_SRC_ACCEL , <0,0,0>,
PSYS_SRC_BURST_PART_COUNT ,20,
PSYS_SRC_BURST_RADIUS , 0.5,
PSYS_SRC_BURST_SPEED_MIN ,1,
PSYS_SRC_BURST_SPEED_MAX ,2,
PSYS_SRC_INNERANGLE, 0.5

,
PSYS_SRC_OUTERANGLE ,0,  

PSYS_SRC_TARGET_KEY ,target,
PSYS_SRC_MAX_AGE , 0,
PSYS_SRC_TEXTURE , " ",
PSYS_PART_START_ALPHA , 1,
PSYS_PART_END_ALPHA , 0.5                            ]);  
} default {
    state_entry ( )
    {        Particles ();}
} ////////-------------------------- ----------------------------

Here's what happens:
(The particles are white because I simply removed the texture "pumpkin" used in the previous post)
Everywhere I go, whatever the position of emettetitori, the particles will follow me wherever I move. If I put the key of an object, the result would have been the same: the particles would be directed toward the object designated as a target.
For a better example, create a target on the sensor:
What we create is a script that is activated and sends the avatar particles detected, otherwise, if it can not detect any avatar within a certain radius, turns off and stops emitting particles.
The structure is simple, we must: - initially set the parameters of the particles, as seen previously.
- llSensorRepeat enter the function () - determine what needs to happen to trigger event sensor - stop the particles if the event occurs no_sensor
//////- septum parameters ----- ------------

Particles ()
{

key target;

integer
glow =
TRUE;                             
integer
bounce =
FALSE;     
                   

integer integer
interpSize =
TRUE;     
                 integer
wind =
FALSE;                           
integer followSource = FALSE;                 


integer
followVel
= TRUE;
;

integer
followTarget = TRUE;


integer flags;
flags = 0; target = llDetectedKey
(0); / / the key target is detected by the sensor if (glow) flags = flags
 if (bounce) flags = flags llParticleSystem ([
PSYS_PART_MAX_AGE , 6, PSYS_PART_FLAGS
, flags, PSYS_PART_START_COLOR , \u0026lt;1,1,1>,
PSYS_PART_END_COLOR , \u0026lt;1,1,1> ;, PSYS_PART_START_SCALE , \u0026lt;0.2,0.2,0>,
PSYS_PART_END_SCALE , \u0026lt;0.2,0.2,0>, PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE
, PSYS_SRC_BURST_RATE , 0.2,
PSYS_SRC_ACCEL
, \u0026lt; , 0,0,0>, PSYS_SRC_BURST_PART_COUNT
,20,

PSYS_SRC_BURST_RADIUS , 0.5,
PSYS_SRC_BURST_SPEED_MIN ,1, PSYS_SRC_BURST_SPEED_MAX ,2,
PSYS_SRC_INNERANGLE, 0.5
,
PSYS_SRC_OUTERANGLE ,0,  

PSYS_SRC_TARGET_KEY ,target,
PSYS_SRC_MAX_AGE , 0,
PSYS_SRC_TEXTURE , " ",
PSYS_PART_START_ALPHA , 1,
PSYS_PART_END_ALPHA
, 0.5
                           ]);} default
{ state_entry
() { ;
llSensorRepeat ("", "", AGENT, 10.0, PI, 3); / / create the sensor

sensor} (integer num) / / when you see someone ...
{ Particles ();}
; no_sensor
() / / if not found anyone ...
{ llParticleSystem
([]);
}}
////////----------------------- -------------------------------
Anyone entering the range of 10 meters, is found and pointed with the particles. I would say very logical and very easy!

0 comments:

Post a Comment