Particle System Overview
The particle system is the basis of the game engine's special effects. It can be used to simulate natural phenomena such as fire, smoke, water, clouds, snow, and fallen leaves. It can also be used to simulate abstract visual effects such as luminous tracks and speed lines.
Basic Structure
The basic unit of a particle system is a particle. A particle generally has attributes such as position, size, color, velocity, acceleration, and life cycle. In each frame, the particle system generally performs the following steps:
- Generate new particles and initialize.
- Delete particles beyond the life cycle.
- Update the dynamic properties of particles.
- Render all valid particles.
The general particle system will consist of the following parts:
- Emitter, used to create particles and initialize particle properties.
- Influencer, used to update the properties of particles.
- Renderer, render particles.
- Particle class, which stores the properties of particles.
- The particle system class manages the above modules.
The Cocos Creator 3D particle system organizes functions in modules, including the following modules:
Module | Description |
---|---|
ParticleSystem | It is used to store all the data displayed in the Inspector, manage the related modules of particle generation, update and destruction, and control the particle playback. |
ShapeModule | Used to control particle emission, including emission direction and speed, and supports predefined emission directions including squares, circles, cones, balls, and hemispheres. |
AnimatorModule | Used to control the state update after particle emission. The supported functions are: size, color, rotation, speed, acceleration, speed limit, texture animation. |
ParticleSystemRenderer | Used to generate the data needed for particle rendering. Including control related to vb, ib, rendering state. |
There are two ways to add a particle system module:
- Add particle system components to nodes like other components (not recommended).
Use the editor to add particle system components (recommended).
- Developers can add particles by clicking Add Component on the right Inspector panel, as shown below:
- You can also add a particle system component through the left-level hierarchy manager right-click-> Create -> Effects-> Particle System, as shown below:
Continue to the Particle System Module documentation。