# Particle system overview

# Overview

The particle system Particle is a Component component inherited from MeshRenderer and can be mounted on an entity. The particle system is used to simulate some visual special effects, such as sparks, knife lights, lightning, clouds, fog, dust, snow, luminous trajectories, etc.

There are different functional modules in the particle system, which can be combined to achieve different particle effects. The particle system panel is as follows:

image.png

You can click Download Tool Novice Guide to learn directly in the tool according to the process.

# Component summary

Particle -> MeshRenderer -> Component -> Object

# dash board

image.png

The dashboard of the particle system is shown in the figure above. Particle Player has the function of playing and stopping special effects of particles. Particle Count represents the current number of particles. Playback Time represents the time from the start of the particle system to the current time.

# Baking mode

Using the baking mode can greatly improve the running performance of the particle system on a real machine.

Limitations of the baking mode: -When the looping property in the emitter module is true and the startLifeTime in the common module is greater than duration, the baking mode is not supported. -When the simulationSpace attribute of the common module is Wrold, the baking mode is not supported. -If baking mode is used, it is not allowed to modify the properties of the particle system at runtime. -If the baking mode is used, it cannot guarantee that the position and speed of the particles are completely random when they are emitted. -In the tool, if you change from "Do not use baking mode" to "Use baking mode", you need to save it and open the scene again to take effect.

# Component module

Module name Description Type
common Common module, used to set basic attributes ** (necessary module) **. engine.Particle.ParticleCommon
emitter Emitter module, used to set the number of launches and related attributes of the launch timing ** (necessary module) **. engine.Particle.ParticleEmitter
renderer Rendering module, used to set the type and rendering related properties ** (necessary module) **. engine.Particle.ParticleRenderer
emitterShape Emitter shape module, used to set the shape, position, and other properties of the particle emitter. engine.Particle.ParticleEmitterShape
rotationByLife Rotation module, used to set attributes related to rotation changes in the life cycle of particles. engine.Particle.ParticleRotationByLife
sizeByLife The size module is used to set the properties related to the size change in the particle life cycle. engine.Particle.ParticleSizeByLife
speedByLife Speed ​​module, used to set the properties related to the movement speed changes in the particle life cycle. engine.Particle.ParticleSpeedByLife
speedLimitByLife Speed ​​limit module, used to set the properties related to the movement speed limit in the life cycle of the particle, and determine the speed of the particle together with the speedByLife module. engine.Particle.ParticleSpeedLimitByLife
colorByLife Color module, used to set the properties of color changes in the life cycle of particles. engine.Particle.ParticleColorByLife
textureSheetAnimation The texture animation module, the user sets the related attributes of the texture animation. engine.Particle.ParticleTextureSheetAnimation

# Control particle playback code example

const particleComp = entity.getComponent(engine.Particle);
particleComp.play(); // Start playing the particle component and the particle components of all child nodes
particleComp.stop(); // Stop playing the particle component and the particle components of all child nodes
点击咨询小助手