3D 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.
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.
Adding a particle system
There are two ways to add a particle system:
Select the node in the Hierarchy panel and click the Add Component button on the Inspector panel, as shown below:
You can also right-click the Hierarchy panel and select Create -> Effects-> Particle System, as shown below:
The Cocos Creator particle system uses modules to organize functions, including the following modules:
|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.
|Used to control particle emission, including emission direction and speed, and supports predefined emission directions including squares, circles, cones, balls, and hemispheres.
|Used to control the state update after particle emission. The supported functions are: size, color, rotation, speed, acceleration, speed limit, texture animation.
|Used to generate the data needed for particle rendering. Including control related to vb, ib, rendering state.