|
|
@@ -136,8 +136,10 @@ Setting emitter textures works just as you have already learned in previous chap
|
|
|
----
|
|
|
|
|
|
. Create a material and load the texture.
|
|
|
-. Tell the Emitter into how many animation steps (x*y) the texture is divided. +The debris texture has 3x3 frames.
|
|
|
-. Optionally, tell the Emitter whether the animation steps are to be at random, or in order. +For the debris, the frames play at random.
|
|
|
+. Tell the Emitter into how many animation steps (x*y) the texture is divided. +
|
|
|
+The debris texture has 3x3 frames.
|
|
|
+. Optionally, tell the Emitter whether the animation steps are to be at random, or in order. +
|
|
|
+For the debris, the frames play at random.
|
|
|
|
|
|
As you see in the debris example, texture animations improve effects because each “flame or “piece of debris now looks different. Also think of electric or magic effects, where you can create very interesting animations by using an ordered morphing series of lightning bolts; or flying leaves or snow flakes, for instance.
|
|
|
|
|
|
@@ -208,7 +210,8 @@ Compare the texture with the resulting effect.
|
|
|
|
|
|
* Black parts of the image become fully transparent.
|
|
|
* White/gray parts of the image are translucent and get colorized.
|
|
|
-* You set the color using `setStartColor()` and `setEndColor()`. +For fire, is's a gradient from yellow to red.
|
|
|
+* You set the color using `setStartColor()` and `setEndColor()`. +
|
|
|
+For fire, is's a gradient from yellow to red.
|
|
|
* By default, the animation is played in order and loops.
|
|
|
|
|
|
Create a grayscale texture in a graphic editor, and save it to your `assets/Effects` directory. If you split up one image file into x*y animation steps, make sure each square is of equal size–just as you see in the examples here.
|
|
|
@@ -232,7 +235,7 @@ emitter.setShape(new EmitterPointShape(Vector3f.ZERO));
|
|
|
----
|
|
|
|
|
|
You create different effects by changing the emitter parameters:
|
|
|
-[cols="4", options="header"]
|
|
|
+[cols="15,45,15,25", options="header"]
|
|
|
|===
|
|
|
|
|
|
<a| Parameter
|
|
|
@@ -251,13 +254,22 @@ a| Vector3f.ZERO
|
|
|
a| Specify a vector how fast particles move and in which start direction.
|
|
|
|
|
|
<a| direction
|
|
|
-a| `getParticleInfluencer(). setVelocityVariation()` +`setFacingVelocity()` +`setRandomAngle()` +`setFaceNormal()` +`setRotateSpeed()`
|
|
|
-a| 0.2f +false +false +Vector3f.NAN +0.0f
|
|
|
+a| `getParticleInfluencer(). setVelocityVariation()` +
|
|
|
+`setFacingVelocity()` +
|
|
|
+`setRandomAngle()` +
|
|
|
+`setFaceNormal()` +
|
|
|
+`setRotateSpeed()`
|
|
|
+a| 0.2f +
|
|
|
+false +
|
|
|
+false +
|
|
|
+Vector3f.NAN +0.0f
|
|
|
a| Optional accessors that control in which direction particles face while flying.
|
|
|
|
|
|
<a| lifetime
|
|
|
-a| `setLowLife()` +`setHighLife()`
|
|
|
-<a| 3f +7f
|
|
|
+a| `setLowLife()` +
|
|
|
+`setHighLife()`
|
|
|
+<a| 3f +
|
|
|
+7f
|
|
|
a| Minimum and maximum time period before particles fade.
|
|
|
|
|
|
<a| emission rate
|
|
|
@@ -266,13 +278,16 @@ a| 20
|
|
|
a| How many new particles are emitted per second.
|
|
|
|
|
|
<a| color
|
|
|
-a| `setStartColor()` +`setEndColor()`
|
|
|
+a| `setStartColor()` +
|
|
|
+`setEndColor()`
|
|
|
a| gray
|
|
|
a| Set to the same colors, or to two different colors for a gradient effect.
|
|
|
|
|
|
<a| size
|
|
|
-a| `setStartSize()` +`setEndSize()`
|
|
|
-a| 0.2f +2f
|
|
|
+a| `setStartSize()` +
|
|
|
+`setEndSize()`
|
|
|
+a| 0.2f +
|
|
|
+2f
|
|
|
a| Set to two different values for shrink/grow effect, or to same size for constant effect.
|
|
|
|
|
|
<a| gravity
|
|
|
@@ -308,4 +323,3 @@ Can you “invert the fire effect into a small waterfall? Here some tips:
|
|
|
You have learned that many different effects can be created by changing the parameters and textures of one general emitter object.
|
|
|
|
|
|
Now you move on to another exciting chapter – the simulation of <<jme3/beginner/hello_physics#,physical objects>>. Let's shoot some cannon balls at a brick wall!
|
|
|
-'''
|