Monday, October 11, 2010

How Much Sleep Eze Should I Take

Particles (Part 2) - Texture Pattern and

Well, once you explain the definition and the generic structure of the particles, we can try more changes to our script. We put a texture.
First, we can try to add a texture to the particles emitted. Since we are close to Halloween, we can try with a texture of pumpkin, transparent background (I had one at random from around the net):



Enter a texture is easy, simply enter the name of the texture as a string in: PSYS_SRC_TEXTURE , "name of the texture (the texture should be present in the contents of the object):







Otherwise we can insert his UUID (which is the method I prefer ). Take the UUID of a texture that is like taking a sound (explained previously): Right-click on the texture in inventory and copy asset UUID. then pasted into the script, including the "."
To facilitate a better view of the same texture, adjust some parameters, given that previous particles were a little small. Septum
a neutral color (white, so that the pumpkins have their natural color), increasing the size and radius. We start from the script of the previous lesson (Particles Part 1) and modify it as said
//-------------------------- ---------------------

Particles () {
integer glow = TRUE
;
integer bounce = FALSE ;                          

integer
interpColor =
TRUE
;                      

integer
interpSize =
integer
wind = FALSE ;                            

integer followSource = FALSE
;                  ;                      
integer
followTarget = FALSE ;
  

integer
flags;
flags = 0;  if (glow) flags = flags ;  if (followVel) flags = flags
PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE ,
PSYS_SRC_BURST_RATE
, 0.2,
PSYS_SRC_ACCEL , \u0026lt;0.0, .5>,
/ / just go up (Z axis)


PSYS_SRC_BURST_PART_COUNT
, 4,

PSYS_SRC_BURST_RADIUS
, 10, PSYS_SRC_BURST_SPEED_MIN
, 0.5,

PSYS_SRC_BURST_SPEED_MAX , 1, / / PSYS_SRC_TARGET_KEY, target,
/ / PSYS_SRC_INNERANGLE, innerAngle, / / PSYS_SRC_OUTERANGLE, outerAngle,
/ / PSYS_SRC_OMEGA, omega,
PSYS_SRC_MAX_AGE , 0, PSYS_SRC_TEXTURE , "pumpkin"
PSYS_PART_START_ALPHA , 1, / / initial maximum transparency
PSYS_PART_END_ALPHA , 0.5 / / transparency final (half)
;]); default} {
state_entry () { Particles ();

//-----------------------------------------}} --------------

we have this result:


Very simply, the issue is kind of explosion and the particles expand to all parties.
Now let's try an 'emission' cone
This time the particles are pointed at a certain position, forming a cone, we can decide which angle and amplitude. This time we're going to change first of all, the parameter:

PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE, which will become
:
PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE

The script is this:
//---------------------------------------------- - Particles () {
integer
glow = TRUE ;
integer bounce =
FALSE ;                          
integer interpColor = TRUE
;                       integer
interpSize = TRUE ;                        integer
wind = FALSE ;                            
integer followSource =
FALSE ;                 
integer followVel = TRUE
;                       integer
followTarget = FALSE ;
   integer
flags; flags = 0;
 if (glow) flags = flags ;  if (followVel) flags = flags
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,
/ / da 0 a 3:14
PSYS_SRC_OUTERANGLE
, 0,
/ / da 0 a 3:14
PSYS_SRC_MAX_AGE
, 0,

PSYS_SRC_TEXTURE "Zucca",
PSYS_PART_START_ALPHA
, 1,

PSYS_PART_END_ALPHA
, 0.5 ;]);}
default {
state_entry () { Particles ();}
}

//---------------- -------------------------------------------------- -----
The difference is significant:

- Explode:

- Cone:

The function that we created, Particles, () contains within it the bulk container llParticleSystem ([]); It 'easy to declare the function before the state of default (as I made up), and then call in the event that we need more.
For example, I might add Particles () to the touch, or collision, or on the sensor. are so many uses, it is getting comfortable with the parameters and "shaping the particles" according to your needs. Questions? : D

0 comments:

Post a Comment