"Unity 3D" Learning Note 42: Particle effects

Source: Internet
Author: User

Particle effects


The principle of particle effects is to combine several particles without rules. To simulate flames and explode. Water droplets, fog and other effects.

To create a particle effect first, click Create--particle System in the hierarchy view to



Particle emitter

Particle emitters are used to set the emission properties of particles, such as particle size, quantity, and speed. After the particle object has been created. You can see all the particle properties in the right-side Inspector View:


Emit: Whether to use a particle emitter.

Min Size: particle minimum size.

Max size: particle maximum dimensions.

Min Energy: The minimum life cycle of a particle, in seconds, which means the particle disappears after n seconds.

Max Energy: The maximum life cycle of a particle, in seconds. Indicates that the particle disappears after n seconds.

Min Emission: The minimum number of particles generated per second.

Max emission: The maximum number of particles generated per second.

World Velocity: The speed of the axes of the particles in 3D worlds.

Local velocity: The movement speed of each axis in the particle's own coordinate system.

Rnd Velocity: The random velocity of each axis particle.

Emitter Velocity Scale: the particle inherits the velocity of the emission.

Tangent velocity: The velocity at which a particle emits a tangent.

Angular velocity: angular velocity of particle emission.

Rnd Angular velocity: random angular velocity of particles.

Rnd Rotation: Whether particles rotate randomly.

Simulate in WorldSpace: whether to simulate particles in world coordinates.

One shot: After selection, the particles are sent only once, or the particles are sent continuously.

Ellipsoid: The position of all axes produced by the particles.

Min Emitter range: Sets the gap between particles.


Particle animation

Particle animation is used to set the animation effect in particle rendering, first of all, the properties in particle animation are briefly described:


Does animate color: whether to turn on the colors of the particle animation. The color will change according to its life cycle.

Color animation[N]: Sets the color in the animated gradient array. This array is 5 long. That is, when the color of the particles changes, loop these 5 colors.

World Rotation axis: particles are rotated around the global axis.

Local rotation axis: particles revolve around the native space axis.

Size grow: The life cycle of particle growth.

Rnd Force: When particles are executing. A random force is added to the particle after each frame.

Force: Particle execution is the addition of a fixed power to the particle at each frame.

Damping: Resistance, used to slow down particles.

Autodestruct: Destroy the Particle animation object on its own initiative.



Particle renderer

Particle renderers are primarily used for particle rendering, such as: rendering mode. Scaling of particles, size of particles, etc.


Cast shadows: Whether to cast shadows of particles.

Receive shadows: Whether to accept the shadow of a particle.

Materials: The material that the particle displays.

Camera Velocity Scale: the speed at which the cameras zoom.

Stretch particles: The display state of a particle, such as landscape or portrait.

Length scale: size of particle scaling.

Velocity scale: the velocity of particle scaling.

Max particle Size: The largest dimension of the particle.

UV Animation: Sets the number of particle animations in the horizontal direction and the amount in the vertical direction as well as the play map animation.



Particle effect instances

Unity provides a very good standard package for particles. Right-click on the project view to eject import package--particles. Import particle standard package with a lot of ready-made particle materials.


Using unityengine;using System.collections;public class Script_06_11:monobehaviour {//particle object gameobject particle = null;/ /particle x-axis speed float velocity_x = 0.0f;//particle y-axis direction speed float velocity_y = 0.0f;//particle z-axis speed float velocity_z = 0.0f;void Start () {//Get particles Object particle = Gameobject.find ("Particlesystem");} void Ongui () {//Drag to set the maximum size of the particle guilayout.label ("particle maximum size");p article.particleEmitter.maxSize = Guilayout.horizontalslider (Particle.particleEmitter.maxSize, 0.0f, 10.0f,guilayout.width (150));//Drag to set the maximum vanishing time of a particle guilayout.label ("Particle Vanishing Time"); Particle.particleEmitter.maxEnergy = Guilayout.horizontalslider (Particle.particleEmitter.maxEnergy, 0.0f, 10.0f, Guilayout.width (150));//Drag to set the maximum number of particles generated guilayout.label ("Maximum number of particles generated");p article.particleEmitter.maxEmission = Guilayout.horizontalslider (Particle.particleEmitter.maxEmission, 0.0f, 100.0f,guilayout.width (150));// Drag to set the particle x-axis movement speed Guilayout.label ("Particle x-axis movement speed"), velocity_x= Guilayout.horizontalslider (velocity_x, 0.0f, 10.0f, Guilayout.width ());p article.particleEmitter.worldVelocity = new Vector3 (velocity_x, PARTICLE.PARTICLEEMITTER.WORLDVELOCITY.Y, particle.particleemitter.worldvelocity.z);// Drag to set the movement speed of the y-axis of the particle guilayout.label ("Velocity of movement of the y-axis of the particle"); velocity_y= Guilayout.horizontalslider (velocity_y, 0.0f, 10.0f, Guilayout.width);p article.particleEmitter.worldVelocity = new Vector3 ( Particle.particleemitter.worldvelocity.x,velocity_y, particle.particleemitter.worldvelocity.z);// Drag to set the movement speed of the particle Z axis guilayout.label ("movement speed of the particle Z axis"), velocity_z= Guilayout.horizontalslider (velocity_z, 0.0f, 10.0f, Guilayout.width);p article.particleEmitter.worldVelocity = new Vector3 ( particle.particleemitter.worldvelocity.x, particle.particleemitter.worldvelocity.y,velocity_z);}}
Perform:




"Unity 3D" Learning Note 42: Particle effects

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.