Unity Game development Tips collection using ninja darts creating particle effects using ninja darts to create particle effects
In the game, such as smoke, fire, water droplets, deciduous and other particle effects can be achieved using the particle system (particle systems). For example, the bonfire in the legend of the Ming Dynasty was shown in 2-32. The newest version of the particle system is also known as Ninja Dart (Shuriken), as the particle system added in the scene resembles Ninja Darts, as shown in 2-33.
Figure 2-32 Bonfire in the game Figure 2-33 particle system, also known as Ninja Darts
Particle basic properties in unity
Before using the particle system, let's look at its basic properties:
- Q Energy: Represents the life cycle of a particle, that is, the time from generation to destruction.
- Q Looping: Determines whether these particles are regenerated after the life cycle of all particles has ended.
- Q Speed,direction,and Rotation: Each particle has transform components, so their direction, orientation, and even size can be different.
The values of particles in unity
The values assigned to each particle can be divided into the following four classes:
- Q Constant (constant): Indicates that the values given to all particles are the same, as shown in 2-34.
Figure 2-34 gives the particle a value of type constant figure 2-35 gives the value of the curve type to the particle
- Q Curve (curve): The value given to a particle varies over time, and the value is given to the value on the curve according to the time, as shown in 2-35.
- Q Random between two Constants (stochastic values within two constant ranges): the value assigned to the particle changes over time, but the given value is limited to the range of two constants. As shown in 2-36.
Figure 2-36 gives the particle the value of the random between-constants type, and the value in Figure 2-37 gives the particle the random between of the curves type.
- Q Random between two Curves (stochastic values in the range of two curves): the value assigned to the particle changes over time, but the given value is limited to the range of two curves. As shown in 2-37.
Unity creates particle effects
There are two ways to create a particle effect:
- Q in Unity, click gameobject| Create other| Particle system command, add particle system (particle systems) to this game object in the game scene.
- Q in Unity, click gameobject| The Create empty command adds an empty game object to the game scene. Select it, and then click component| effects| The particle system command adds the particle system (particle systems) component to an empty game object.
The particle effects seen in scene view and game view are shown in 2-38.
Figure 2-38 the particle effect in scene view and game view
Understanding the initialization module of particle systems
The Shuriken (Ninja Dart) particle system, which is managed by modularity, makes it easier for developers to create colorful and complex particle effects, thanks to a personalized particle module, coupled with a particle curve editor. The shuriken particle system has up to 17 modules, select the particle system in the scene view, and in the Inspector view you can see the 17 modules, as shown in 2-39.
Figure 2-39 17 Modules of shuriken particle system Figure 2-40 particle effects Panel
In addition, when you select the particle system in scene view, the particle Effect (particle effects) panel appears in Scene view, as shown in 2-40. The functions of the controls in the panel are described below:
- Q Pause: Click this button to pause playback of the current particle. Click this button again to continue playing.
- Q STOP: Click this button to stop the playback of the particles.
- Q Playback Speed (playback rate): Can change the speed of the particle playback, the greater the value, the faster the playback speed.
- Q Playback Time: Sets the particle effect at which time the playback is played.
Click on the particle system module in the Inspector view to expand this module, as shown in 2-41, as with other modules, which can set the state of the particle system when it is initialized.
Figure 2-41 Module diagram for setting the state of the particle system initialization 2-42 Start size value 4 types
The setting method is then described as an example of setting the value of start size when initializing. Clicking on the far right of this property pops up the selection of 4 type values, as shown in 2-42.
- Q The default selection is constant, which sets the value of start size to constant, that is, all particles are the same size in the process of playing the particles, as shown in 2-43.
Figure 2-43 The effect of the particle playback when Start size is a value of type constant
- Q When you select Curve, you can edit the shape of the curve in the Curve editor, set the value of start size to the value on the curve, and the effect of the particle playback is shown in 2-44. As time changes, particles grow larger.
Figure 2-44 The effect of the particle playback when Start size is a value of type curve
- Q When you select the random between two constants, set the value of start size to any value between two constants, as shown in effect 2-45 of the particle playback. At any given moment, particles are always big and small.
Figure 2-45 The effect of a particle play when Start size is a value of random between of type constants
- Q When you select the random between two curves, you can edit the shape of both curves in the Curve editor, setting the value of start size to any value in the curve range, as shown in effect 2-46 of the particle playback. Particles are big and small at any time, but as time goes on, all particles become bigger and larger.
Figure 2-46 The effect of a particle play when Start size is a value of random between of type curves
This article is selected from: Unity Game Development Tips Collection University bully internal information, reproduced please indicate the source, respect the technology respect the IT person!
Unity Game development Tips using ninja darts to create particle effects