Time for action – fire!
Let's have a look at a classic fire effect. You can use it in combination with a Point Light, for campfires, torches, or for a wizard's fireball spell.
- Make a copy of
Main.java
and name the classParticle6Fire.java
. Remember to also refactor the first line of themain()
method toParticle6Fire app = new Particle6Fire();
. - Copy the included file
assets/Effects/flame.png
into your project'sassets/Effect
directory. It includes a sprite animation of flames. - Initialize the emitter, give it a material based on
Particle.j3md
, and attach it to the scene:public void simpleInitApp() { ParticleEmitter fireEmitter = new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 30); Material fireMat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md"); ...
Get jMonkeyEngine 3.0 Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.