Particle effects are used to visually enhance games. You can use them to create explosions, blood splatter, trails, weather or any other effect.
Particle effects consists of a number of emitters and optional modifiers:
Select New... ▸ Particle FX from the context menu in the Assets browser. Name the new particle effect file. The editor will now open the file using the Scene Editor.
The Outline pane shows the default emitter. Select the emitter to bring up its properties in the Properties pane below.
To add a new emitter to the effect, right click the root of the Outline and select Add Emitter ▸ [type] from the context menu. Note that you can change the type of the emitter in the emitter properties.
To add a new modifier, right click the location of the modifier in the Outline (the effect root or a particular emitter) and select Add Modifier, then select the modifier type.
A modifier that sits on the effect root (not childed to an emitter) affects all particles in the effect.
A modifier that is added as a child to an emitter affects only that emitter.
When editing an emitter or modifier the result is immediately visible in the editor, even with the effect paused:
Oncestops the emitter after reaching its duration.
Looprestarts the emitter after reaching its duration.
Autokeeps the size of each flipbook animation frame to the source image.
Manualsets the particle size according to the size property.
Worldmoves the particles independent of the emitter.
Emittermoves the particles relative to the emitter.
Circle emits particles from a random location inside a circle. The particles are directed outwards from the center. The circle diameter is defined by Emitter Size X.
2D Cone emits particles from a random location inside a flat cone (a triangle). The particles are directed out of the top of the cone. Emitter Size X defines the width of the top and Y defines the height.
Box emits particles from a random location inside a box. The particles are directed up along the box’ local Y-axis. Emitter Size X, Y and Z defines width, height and depth respectively. For a 2D rectangle, keep the Z size at zero.
Sphere emits particles from a random location inside a sphere. The particles are directed outwards from the center. The sphere diameter is defined by Emitter Size X.
Cone emits particles from a random location inside a 3D cone. The particles are directed out through the top disc of the cone. Emitter Size X defines the diameter of the top disc and Y defines the height of the cone.
Defaultsets the orientation to unit orientation
Initial Directionkeeps the initial orientation of the emitted particles.
Movement Directionadjusts the orientation of the particles according to their velocity.
World. The velocity of the emitter is estimated every frame.
The Blend Mode property defines how the component graphics should be blended with the graphics behind it. These are the available blend modes and how they are calculated:
These properties have two fields: a value and a spread. The spread is a variation which is applied randomly for each spawned particle. E.g. if the value is 50 and the spread is 3, each spawned particle will get a value between 47 and 53 (50 +/- 3).
By checking the key button, the value of the property is controlled by a curve over the duration of the emitter. To reset a keyed property, uncheck the key button.
The Curve Editor (available among the tabs in the bottom view) is used to modify the curve. Keyed properties can’t be edited in the Properties view, only in the Curve Editor. Click and drag the points and tangents to modify the shape of the curve. Double-click on the curve to add control points. To remove a control point, double click on it.
To auto-zoom the Curve Editor to display all curves, press F.
The following properties can be keyed over the play time of the emitter:
Automaticand use a flipbook animation as image source, this property is ignored.
The following properties can be keyed over the life time of the particles:
There are four types of modifiers available that affect the velocity of particles:
To start and stop a particle effect from a script:
-- start the effect component "particles" in the current game object particlefx.play("#particles") -- stop the effect component "particles" in the current game object particlefx.stop("#particles")
A particle effect will continue to emit particles even if the game object the particle effect component belonged to is deleted.
See the Particle FX reference documentation for more information.
The default particle effect material has the following constants that can be changed using
particlefx.set_constant() and reset using
particlefx.reset_constant() (refer to the Material manual for more details):
vector4). The vector4 is used to represent the tint with x, y, z, and w corresponding to the red, green, blue and alpha tint. Refer to the API reference for an example.
The game.project file has a few project settings related to particles.
Did you spot an error or do you have a suggestion? Please let us know on GitHub!GITHUB