Game Development Reference
In-Depth Information
How to do it…
The first section will describe how to set up a material we can use. This consists of the fol-
lowing steps:
1. We're going to start by creating a material to supply to the
ParticleEmitter
class. Create a new material in the
Materials
folder by right-clicking and selecting
New…
and then
Empty Material File
.
2. Rename it to something suitable, for example,
Birds.j3m
.
3. Now, we can open it and are automatically moved to the
Material Editor
window.
4. Here, we set the
Material Definition
value to
Common/Matdefs/Misc/Un-
shaded.j3md
.
5. The only thing we need to change is the
ColorMap
value, which should be pointed
to our birds texture.
Now, we come to the configuration of the
ParticleEmitter
class. This section con-
sists of the following steps:
1. Let's begin by creating a new scene and opening it in the
SceneExplorer
window.
Right-click and select
Add Spatial..
and then
Particle Emitter
. A default smoke
puffing the
ParticleEmitter
object is created.
2. Now, we can bring up the
Properties
window and start tweaking it.
3. First of all, we set the material to our newly created material for the birds. Don't
worry if it looks terrible!
4. Looking at the
Images X
property, we can see that it's set to
15
by default. This
is the amount of horizontal "frames" in the texture. If we look at the birds texture,
we can see that it's only four frames, so let's change that value. The particles are
already looking better.
5.
High Life
and
Low Life
define the maximum or minimum lifespan of a
particle. We can assume that the birds should soar across the sky for a while, so
let's change it to
30
and
25
respectively.
6. There are an awful lot of birds now. Setting
Num Particles
to
50
will make
more sense.
7.
Start Size
and
End Size
affect the size of the particles over time. These
should be set to
1
for our birds. They shouldn't inflate.
8. For now, let's increase the radius of the emitter to get a better view. It's a sphere by
default and the last value is the radius. Set it to
30
.