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:
SelectNew... ▸ Particle FX from the context menu in theAssets browser. Name the new particle effect file. The editor will now open the file using theScene Editor.
TheOutline pane shows the default emitter. Select the emitter to bring up its properties in theProperties pane below.
To add a new emitter to the effect,right click the root of theOutline and selectAdd 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 theOutline (the effect root or a particular emitter) and selectAdd 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:
Once
stops the emitter after reaching its duration.Loop
restarts the emitter after reaching its duration.Auto
keeps the size of each flipbook animation frame to the source image.Manual
sets the particle size according to the size property.World
moves the particles independent of the emitter.Emitter
moves the particles relative to the emitter.Alpha
,Add
andMultiply
.Circle
emits particles from a random location inside a circle. The particles are directed outwards from the center. The circle diameter is defined byEmitter 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 andY 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 andZ 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 byEmitter 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 andY defines the height of the cone.
Default
sets the orientation to unit orientationInitial Direction
keeps the initial orientation of the emitted particles.Movement Direction
adjusts the orientation of the particles according to their velocity.World
. The velocity of the emitter is estimated every frame.TheBlend 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:
src.a * src.rgb + (1 - src.a) * dst.rgb
src.rgb + dst.rgb
src.rgb * dst.rgb
src.rgb - dst.rgb * dst.rgb
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.
TheCurve Editor (available among the tabs in the bottom view) is used to modify the curve. Keyed properties can’t be edited in theProperties view, only in theCurve 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, pressF.
The following properties can be keyed over the play time of the emitter:
Automatic
and 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:
Acceleration
Drag
Radial
Vortex
To start and stop a particle effect from a script:
-- start the effect component "particles" in the current game objectparticlefx.play("#particles")-- stop the effect component "particles" in the current game objectparticlefx.stop("#particles")
To start and stop a particle effect from a GUI script see theGUI Particle FX manual for more information.
A particle effect will continue to emit particles even if the game object the particle effect component belonged to is deleted.
See theParticle FX reference documentation for more information.
The default particle effect material has the following constants that can be changed usingparticlefx.set_constant()
and reset usingparticlefx.reset_constant()
(refer to theMaterial manual for more details):
tint
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 theAPI reference for an example.Thegame.project file has a fewproject settings related to particles.
Did you spot an error or do you have a suggestion? Please let us know on GitHub!
GITHUB