Meshes can be sculpted, animated, and made translucent—but when a game scene requires smoke, sparks, or flames, then meshes just don't make the cut. When you want to simulate a fuzzy shape in real time, particles are the weapon of choice. A particle system has two secret ingredients: sprites and an emitter. In the following screenshot, you see a particle system that uses a 9-frame sprite animation (left) to simulate spinning flying pieces of debris (right):
The heart of a particle system is the ParticleEmitter
object (from the com.jme3.effect
package). The emitter object determines the start location of the effect and stores the texture and animation properties. To add the effect to the scene, you attach a particle emitter to a node under the root node like any other scene object. We'll look at some code samples.