|
|
@@ -5,6 +5,8 @@
|
|
|
:keywords: documentation, effect
|
|
|
:relfileprefix: ../../
|
|
|
:imagesdir: ../..
|
|
|
+:uri-jmonkeyengine: https://github.com/jMonkeyEngine/jmonkeyengine/tree/master/
|
|
|
+:uri-forum: https://hub.jmonkeyengine.org/
|
|
|
ifdef::env-github,env-browser[:outfilesuffix: .adoc]
|
|
|
|
|
|
|
|
|
@@ -24,6 +26,7 @@ image:jme3/advanced/explosion-5.png[explosion-5.png,width="150",height="100"] i
|
|
|
== Create an Emitter
|
|
|
|
|
|
. Create one emitter for each effect:
|
|
|
++
|
|
|
[source,java]
|
|
|
----
|
|
|
ParticleEmitter explosion = new ParticleEmitter(
|
|
|
@@ -31,6 +34,7 @@ ParticleEmitter explosion = new ParticleEmitter(
|
|
|
----
|
|
|
|
|
|
. Attach the emitter to the rootNode and position it in the scene:
|
|
|
++
|
|
|
[source,java]
|
|
|
----
|
|
|
rootNode.attachChild(explosion);
|
|
|
@@ -38,12 +42,14 @@ explosion.setLocalTranslation(bomb.getLocalTranslation());
|
|
|
----
|
|
|
|
|
|
. Trigger the effect by calling
|
|
|
++
|
|
|
[source,java]
|
|
|
----
|
|
|
explosion.emitAllParticles()
|
|
|
----
|
|
|
|
|
|
. End the effect by calling
|
|
|
++
|
|
|
[source,java]
|
|
|
----
|
|
|
explosion.killAllParticles()
|
|
|
@@ -75,17 +81,22 @@ a| The maximum number of particles visible at the same time. Specified by user i
|
|
|
<a| emission rate
|
|
|
a| `setParticlesPerSec()`
|
|
|
a| 20
|
|
|
-a| Density of the effect, how many new particles are emitted per second. +Set to zero to control the start/end of the effect. +Set to a number for a constantly running effect.
|
|
|
+a| Density of the effect, how many new particles are emitted per second. +
|
|
|
+Set to zero to control the start/end of the effect. +
|
|
|
+Set to a number for a constantly running effect.
|
|
|
|
|
|
<a| size
|
|
|
a| `setStartSize()`, `setEndSize()`
|
|
|
a| 0.2f, 2f
|
|
|
-a| The radius of the scaled sprite image. Set both to same value for constant size effect. +Set to different values for shrink/grow effect.
|
|
|
+a| The radius of the scaled sprite image. Set both to same value for constant size effect. +
|
|
|
+Set to different values for shrink/grow effect.
|
|
|
|
|
|
<a| color
|
|
|
a| `setStartColor()`, `setEndColor()`
|
|
|
a| gray
|
|
|
-a| Controls how the opaque (non-black) parts of the texture are colorized. +Set both to the same color for single-colored effects (e.g. fog, debris). +Set both to different colors for a gradient effect (e.g. fire).
|
|
|
+a| Controls how the opaque (non-black) parts of the texture are colorized. +
|
|
|
+Set both to the same color for single-colored effects (e.g. fog, debris). +
|
|
|
+Set both to different colors for a gradient effect (e.g. fire).
|
|
|
|
|
|
<a| direction/velocity
|
|
|
a| `getParticleInfluencer(). setInitialVelocity(initialVelocity)`
|
|
|
@@ -95,17 +106,24 @@ a| A vector specifying the initial direction and speed of particles. The longer
|
|
|
<a| fanning out
|
|
|
a| `getParticleInfluencer(). setVelocityVariation(variation)`
|
|
|
a| 0.2f
|
|
|
-a| How much the direction (`setInitialVelocity()`) can vary among particles. Use a value between 1 and 0 to create a directed swarm-like cloud of particles. +1 = Maximum variation, particles emit in random 360° directions (e.g. explosion, butterflies). +0.5f = particles are emitted within 180° of the initial direction. +0 = No variation, particles fly in a straight line in direction of start velocity (e.g. lasergun blasts).
|
|
|
+a| How much the direction (`setInitialVelocity()`) can vary among particles. Use a value between 1 and 0 to create a directed swarm-like cloud of particles. +
|
|
|
+1 = Maximum variation, particles emit in random 360° directions (e.g. explosion, butterflies). +
|
|
|
+0.5f = particles are emitted within 180° of the initial direction. +
|
|
|
+0 = No variation, particles fly in a straight line in direction of start velocity (e.g. lasergun blasts).
|
|
|
|
|
|
-a| direction +(pick one)
|
|
|
+a| direction +
|
|
|
+(pick one)
|
|
|
a| `setFacingVelocity()`
|
|
|
a| false
|
|
|
-a| true = Flying particles pitch in the direction they're flying (e.g. missiles). +false = Particles keep flying rotated the way they started (e.g. debris).
|
|
|
+a| true = Flying particles pitch in the direction they're flying (e.g. missiles). +
|
|
|
+false = Particles keep flying rotated the way they started (e.g. debris).
|
|
|
|
|
|
-a| direction +(pick one)
|
|
|
+a| direction +
|
|
|
+(pick one)
|
|
|
a| `setFaceNormal()`
|
|
|
a| Vector3f.NAN
|
|
|
-a| Vector3f = Flying particles face in the given direction (e.g. horizontal shockwave faces up = Vector3f.UNIT_Y). +Vector3f.NAN = Flying particles face the camera.
|
|
|
+a| Vector3f = Flying particles face in the given direction (e.g. horizontal shockwave faces up = Vector3f.UNIT_Y). +
|
|
|
+Vector3f.NAN = Flying particles face the camera.
|
|
|
|
|
|
<a| lifetime
|
|
|
a| `setLowLife()`, `setHighLife()`
|
|
|
@@ -115,17 +133,20 @@ a| The time period before a particle fades is set to a random value between mini
|
|
|
<a| spinning
|
|
|
a| `setRotateSpeed()`
|
|
|
a| 0f
|
|
|
-a| 0 = Flying particles don't spin while flying (e.g. smoke, insects, controlled projectiles). +> 0 = How fast particle spins while flying (e.g. debris, shuriken, missiles out of control).
|
|
|
+a| 0 = Flying particles don't spin while flying (e.g. smoke, insects, controlled projectiles). +
|
|
|
+> 0 = How fast particle spins while flying (e.g. debris, shuriken, missiles out of control).
|
|
|
|
|
|
<a| rotation
|
|
|
a| `setRandomAngle()`
|
|
|
a| false
|
|
|
-a| true = The particle sprite is rotated at a random angle when it is emitted (e.g. explosion, debris). +false = Particles fly straight like you drew them in the sprite texture (e.g. insects).
|
|
|
+a| true = The particle sprite is rotated at a random angle when it is emitted (e.g. explosion, debris). +
|
|
|
+false = Particles fly straight like you drew them in the sprite texture (e.g. insects).
|
|
|
|
|
|
<a| gravity
|
|
|
a| `setGravity()`
|
|
|
a| Vector3f(0.0f,0.1f,0.0f)
|
|
|
-a| Particles fall in the direction of the vector (e.g. debris, sparks). +(0,0,0) = Particles keep flying in start direction (e.g. flames, zero-gravity explosion.)
|
|
|
+a| Particles fall in the direction of the vector (e.g. debris, sparks). +
|
|
|
+(0,0,0) = Particles keep flying in start direction (e.g. flames, zero-gravity explosion.)
|
|
|
|
|
|
<a| start area
|
|
|
a|`setShape(new EmitterSphereShape( Vector3f.ZERO, 2f));`
|
|
|
@@ -140,7 +161,7 @@ Build up you effect by specifying one parameter after the other. If you change s
|
|
|
== Create an Effect Material
|
|
|
|
|
|
|
|
|
-image::http://jmonkeyengine.googlecode.com/svn/trunk/engine/test-data/Effects/Explosion/flash.png[flash.png,width="128",height="128",align="right"]
|
|
|
+image::{uri-jmonkeyengine}jme3-testdata/src/main/resources/Effects/Explosion/flash.png[flash.png,width="128",height="128",align="right"]
|
|
|
|
|
|
|
|
|
Use the common Particle.j3md Material Definition and a texture to specify the shape of the particles. The shape is defined by the texture you provide and can be anything – debris, flames, smoke, mosquitoes, leaves, butterflies… be creative.
|
|
|
@@ -180,35 +201,35 @@ a| Preview
|
|
|
|
|
|
<a| Effects/Explosion/Debris.png
|
|
|
<a| 3*3
|
|
|
-a| image:http://jmonkeyengine.googlecode.com/svn/trunk/engine/test-data/Effects/Explosion/Debris.png[Debris.png,width="32",height="32"]
|
|
|
+a| image:{uri-jmonkeyengine}jme3-testdata/src/main/resources/Effects/Explosion/Debris.png[Debris.png,width="32",height="32"]
|
|
|
|
|
|
<a| Effects/Explosion/flame.png
|
|
|
<a| 2*2
|
|
|
-a| image:http://jmonkeyengine.googlecode.com/svn/trunk/engine/test-data/Effects/Explosion/flame.png[flame.png,width="32",height="32"]
|
|
|
+a| image:{uri-jmonkeyengine}jme3-testdata/src/main/resources/Effects/Explosion/flame.png[flame.png,width="32",height="32"]
|
|
|
|
|
|
<a| Effects/Explosion/flash.png
|
|
|
<a| 2*2
|
|
|
-a| image:http://jmonkeyengine.googlecode.com/svn/trunk/engine/test-data/Effects/Explosion/flash.png[flash.png,width="32",height="32"]
|
|
|
+a| image:{uri-jmonkeyengine}jme3-testdata/src/main/resources/Effects/Explosion/flash.png[flash.png,width="32",height="32"]
|
|
|
|
|
|
a| Effects/Explosion/roundspark.png
|
|
|
<a| 1*1
|
|
|
-a| image:http://jmonkeyengine.googlecode.com/svn/trunk/engine/test-data/Effects/Explosion/roundspark.png[roundspark.png,width="32",height="32"]
|
|
|
+a| image:{uri-jmonkeyengine}jme3-testdata/src/main/resources/Effects/Explosion/roundspark.png[roundspark.png,width="32",height="32"]
|
|
|
|
|
|
<a| Effects/Explosion/shockwave.png
|
|
|
<a| 1*1
|
|
|
-a| image:http://jmonkeyengine.googlecode.com/svn/trunk/engine/test-data/Effects/Explosion/shockwave.png[shockwave.png,width="32",height="32"]
|
|
|
+a| image:{uri-jmonkeyengine}jme3-testdata/src/main/resources/Effects/Explosion/flame.png[shockwave.png,width="32",height="32"]
|
|
|
|
|
|
a| Effects/Explosion/smoketrail.png
|
|
|
<a| 1*3
|
|
|
-a| image:http://jmonkeyengine.googlecode.com/svn/trunk/engine/test-data/Effects/Explosion/smoketrail.png[smoketrail.png,width="32",height="32"]
|
|
|
+a| image:{uri-jmonkeyengine}jme3-testdata/src/main/resources/Effects/Explosion/smoketrail.png[smoketrail.png,width="32",height="32"]
|
|
|
|
|
|
<a| Effects/Explosion/spark.png
|
|
|
<a| 1*1
|
|
|
-a| image:http://jmonkeyengine.googlecode.com/svn/trunk/engine/test-data/Effects/Explosion/spark.png[spark.png,width="32",height="32"]
|
|
|
+a| image:{uri-jmonkeyengine}jme3-testdata/src/main/resources/Effects/Explosion/spark.png[spark.png,width="32",height="32"]
|
|
|
|
|
|
<a| Effects/Smoke/Smoke.png
|
|
|
a| 1*15
|
|
|
-a| image:http://jmonkeyengine.googlecode.com/svn/trunk/engine/test-data/Effects/Smoke/Smoke.png[Smoke.png,width="96",height="32"]
|
|
|
+a| image:{uri-jmonkeyengine/jme3-testdata/src/main/resources/Effects/Smoke/Smoke.png[Smoke.png,width="96",height="32"]
|
|
|
|
|
|
|===
|
|
|
|