MainModule is the main module of ParticleGeneratorModule
, containing the most basic particle generation parameters. These properties are mostly used to control the initial state of newly created particles.
You can debug each property one by one in the provided example to help you better understand and control the main particle module, thereby achieving various complex and beautiful visual effects.
Duration duration determines how long the particle generator runs, in seconds. A longer duration means the particle system will generate more particles, creating a continuous effect.
Is Loop isLoop if set to true, the particle generator will automatically restart after the duration ends, forming a continuous effect, such as smoke or flowing water.
Start Delay startDelay determines the delay time before the particle generator starts emitting after being activated, which is useful for effects that require a time difference, such as fireworks.
Start Lifetime startLifetime determines how long each particle can live before disappearing. A longer lifetime means particles will stay on the screen longer.
Start Speed startSpeed determines the speed at which particles are emitted. Higher initial speed will cause particles to spread quickly, like an explosion effect; lower speed will make particles drift slowly, like a smoke effect.
Start Size 3D startSize3D allows setting different sizes for the x, y, z axes of the particles to achieve anisotropic particle effects, such as elongated flames. The initial size of particles when the particle generator first generates particles startSize controls the size of each particle. Larger initial size is suitable for simulating large clouds of smoke or flames, while smaller size is suitable for fine dust or splashes. For specific axis initial size, the initial size along the x-axis startSizeX, along the y-axis startSizeY, and along the z-axis startSizeZ respectively control the size of particles on the x, y, z axes, making the particle shapes more diverse and delicate.
Start Rotation 3D startRotation3D allows particles to rotate in 3D space, increasing the three-dimensionality and complexity of particles, such as falling leaves in three-dimensional space. The initial rotation of particles when the particle generator first generates particles (startRotation) sets the rotation angle of particles when emitted, suitable for effects where particles need to move in a specific direction, such as directional flames. The initial rotation along the x-axis startRotationX, along the y-axis startRotationY, and along the z-axis startRotationZ respectively control the rotation of particles on the x, y, z axes, increasing the freedom of particle movement. Flip Rotation flipRotation ranges from 0 to 1, making some particles rotate in the opposite direction, increasing the randomness and naturalness of the particle system, suitable for simulating complex motion trajectories.
Start Color startColor determines the color of particles, which can be used to simulate different material effects, such as the red-orange color of flames or the gray-white color of smoke.
Gravity Modifier gravityModifier adjusts the degree to which particles are affected by gravity, making particles look more realistic, such as falling raindrops or rising smoke.
The choice of simulation space simulationSpace determines whether particles move relative to the world or to the emitter itself. World space is suitable for effects with fixed positions, such as smoke; local space is suitable for effects that move with objects, such as flame trails.
Simulation speed simulationSpeed can globally increase or decrease the movement speed of particles, suitable for slow-motion or accelerated effects.
Scaling mode scalingMode determines how the particle emitter handles position, rotation, and scaling transformations when emitting particles. Using scalingMode ensures that the transformation relationship between the particle emitter and particles meets expectations. scalingMode has the following modes:
Local: Particles inherit the local transformation of the particle emitter, meaning particle transformations occur in the emitter's local coordinate system.
World: Particles inherit the global transformation of the particle emitter, meaning particle transformations occur in the world coordinate system.
Hierarchy: Particles inherit transformations from the entire hierarchy, considering the parent and higher-level transformations of the emitter.
If set to true, the particle emitter will automatically start playing when enabled playOnEnabled. Enabling this option ensures that the particle system starts emitting particles immediately upon startup, suitable for scenes requiring immediate display of effects.
Maximum particles maxParticles limits the maximum number of particles in the particle system to prevent performance issues. A larger value is suitable for effects requiring a large number of particles, such as dense smoke.