Game Development Reference
In-Depth Information
Note that this gravity is set per emitter and is completely independent from the physics
world's gravity. Changing the emitter mode will drastically alter the behavior of the
particles and allow you to use one of the two sets of mode properties shown in Figure
12-6 .
The Position var property determines where a particle spawns. If this property is set to
0x0, the particle will spawn at exactly the same position as the emitter node. With x set to
250, each new particle will randomize its initial position within a range of plus/minus 250
points. If the particle emitter's position is at 250x0, the particles are allowed to spawn
between 0 to 500 along the x axis. This type of randomized plus/minus variation is used
by many other particle-emitter properties, indicated either by the keyword var or by the ±
symbol.
The Emit rate determines how many particles will be spawned per second. The Duration
determines how long (in seconds) the emitter will emit particles before it stops. A Dura-
tion of -1 means the emitter will never stop to emit particles. The Total particles value de-
termines how many particles can be alive at most. It is absolutely crucial to keep this
number as low as possible to still achieve the desired effect. The tweaking involved to cre-
ate the same effect or a similar effect that uses fewer particles than the original effect is
often time well spent.
Life refers to the duration (in seconds) a particle remains visible. While alive, a particle
counts toward the Total particles count. For this and all following properties, the value
field to the right of the plus/minus sign refers to a variance that is randomly added to or
subtracted from the value to the left.
In this case, the default lifetime for every particle is six seconds, plus a random value in
the range of -2.0 and 2.0. This means each particle will have a random lifetime between
four to eight seconds.
Tip Life, emit rate, and total particles influence each other. If you want an
emitter that shoots out a stream of particles and then pauses, you'll simply have
to ensure that the lifetime and emit rate are such that the emitted particles reach
the total particle count before some of the particles' lives end.
With an emit rate of 10 particles per second and a lifetime of 3 seconds, you'll
have 30 particles living within 3 seconds. Now if you set the total particle count
to 15, the emitter will emit particles for 1.5 seconds and then stop emitting new
particles for another 1.5 seconds. After 3 seconds, it will emit new particles for
another 1.5 seconds and then pause another 1.5 seconds.
Search WWH ::




Custom Search