09 effects system

  

  Particle system
particle components: production of particle effects in Unity is achieved by ParticleSystem components can be created directly Hierarchy, right, you can also create a space object by adding ParticleSystem components to achieve the object is empty.

Particle system properties

(1) Duration: duration of the entire particle system
(2) Looping: whether open loop, open loop after particle effects
(3) Prewarm: warm-up to see whether the open only after the open loop can check this option
(4 ) Start delay: warm-up delay. This option can not be checked after the check preheating
(5) Start Lifetime: Lifecycle particle, a particle appears to disappear from time
(6) Start Speed: transmitting particle velocity occurs
(7) 3D Start Size: XYZ may change the particle size axis
(8) Start size: particle size directly change
(9) Start rotation: the rotation angle of the emerging particles
(10) Randomize Roation: particle rotation angle during movement
(11) StartColor; particle color (a variety of color patterns, gradient ...)
(12) GravityModifier: whether a particle is affected by gravity, zero gravity is not the time
(default value is 0, representing the particles did not suffer heavy particle impact, it will have to floating on, the numerical value increases, the particle will fall down).
(13 is) SimulationSpace: particle coordinate system (local coordinates, world coordinates, custom)
(14) SimulationSpeed: speed inherited, inherited speed of the moving velocity of the particle
(15) ScalingMode: scaling
(16) PlayOnAwake: check to start the game after playing
the maximum number of particles released: (17) MaxParticle
(Assuming 100 is set, when the number of particles that reach the scene of the limit 100, the emitter particles will temporarily stops transmitting radio, and other parts of the particle will continue to transmit disappears.)
(18 is) AutoRandomSeed: automatic random particles

                            Particle emission module

 

RateoverTime: launch time
RateoverTime: Transmission Distance
Bursts: explosions

                        Particle shape of the module system

 

Shape: the shape (spherical, hemispherical, conical, cubic, grid, circular, blade-shaped)
Angle: the angle of the vertebral
Radius: the radius of the vertebral body
Length: vertebral height (when available Emitform value volumeshell or Volume)
Emitform: position of the particles emitted
Randomize (Spherize) direction: random emission direction is

                    The speed of the particles throughout the life cycle

 

Space: coordinate mode (world coordinates, their coordinates)

                    Limit Velocity over Lifetime: rate limiting module


 

Separate Axes: separating axial

Speed: Speed limit

Dampen: damping, when the speed exceeds the speed limit, the speed reduces

Curve: curve;
the Random the Constants the Between Two: constant direct two random
Random Between Two Curves: In two randomized directly curves

                 Speed ​​inherit

Mode: initial: inheritance speed, Current: Current speed

Force over Lifetime: x, y, z, in x, y, z-axis of the restraining force applied

Space: the reference coordinate system

Randomize: only be enabled when Random Between Two Constants or Random Between Two Curves
            color change in the life cycle of particles

         Change the color of speed change occurs

Color: Color values

Gradient: Gradient

Random Between Two Gradients: random color gradient in two

Random Between Two Gradients: random color gradient in two
                   Size over Lifetime: controlling the size of the particles in the life cycle of


Curve: Curve

Random Between Two Constants: constants between two random

Random BeTween Two Curves: curve between two random

Size by Speed: controlling the particle size by controlling the speed


size: Size

Curve: curve
Random Between Two Constants: between two random constants
Random BeTween Two Curves: randomly between two curves
                      particle rotation angle lifecycle

By controlling the rotation angle of the particle velocity

External Forces: external force influence on the particle system modules

Noise: Noise

Separate Axes: single axis

Strength: the strength

Frequency: Frequency

Scroll speed: the scroll speed

Damping: damping

Octaves: Amplitude

Octaves Multiplier: increase the amplitude of

Quality: mass

Remap: remapping

Remap Curve: remapping curve
                      particle system crash module

Planes: plane collision (collision type: planes, world: the world coordinate collision) plane crash supports up to six
Visualization: the plane crash are displayed
ScalePlane: scaling plane
Dampen: damping coefficient
Bounce: bounce factor
LifetimeLoss: collision during the life cycle loss probability factor
MinKillSpeed: minimum speed particle system crash destroyed
MaxKillSpeed: maximum speed particle system crash destroyed
RadiusScale: particle radius
SendCollisionMessage: whether to send information about the collision

实现碰撞的方法
void OnParticleCollision (GameObject other) {
            Rigidbody body = other.GetComponent.<Rigidbody>();
            if (body) {

             Vector3 direction = other.transform.position - transform.position;
             direction = direction.normalized;
             body.AddForce (direction * 5);

} }

Trigger module Triggers particle system

colliders: object particle triggered
Inside: Internal Trigger particles
outside: External Trigger particle
Enter: start trigger
Exit: Trigger End
RadiusScale: triggering radius
VisualizeBounds: imagine the scope of
               the ion emitter system: Sub Emitters

Brith: just generated when particles called sub-emitters
Collision: When particles collide called sub-emitters
Death: particle-emitting devices called when the destruction of the
             particle system animation map

Tiles: division number X: horizontal split; Y: vertical segmentation
Animation: WholeSheet: All participating image frame animation
SingleRow: participating in a single line image frame animation
FraneoverTime: animation frame rate changes during the life cycle
Cycles: the particles within the lifecycle , the frame number of the animation cycles
               particle system rendering module

RenderMode: BillBoard: Rendering panel
StretchedBillBorard: Tensile rendering
HorizontalBillBorard: horizontal rendering
VerticalBillBorard: Vertical rendering
MeshBillBorard: rendering grid
NormalDirection: normal direction
Material: Material
SortMode: sorting mode
Min / Max Particle Size: Minimum / maximum particle size
CustomShadows: projection is turned
ReceiveShadows: receiving projection
SortingLayer: ordered hierarchy
order in layer: in the order of the layers in
Resimulate: restart particle emission
linear rendering
linear used to render a linear render component (LineRenderer), it is the assembly of two or more points draw a straight line between, a linear renderer can draw any assembly line, from a simple linear-to-helix complex. If you want to draw the line two or more, you need to create more game objects, each game object rendering components are mounted linear.
                    Linear render component (LineRenderer)

Cast Shadows: Cast shadows
Receive Shadows: Accept shadow
Motion Vectors: motion vector (only camera movement, a game object moves, no motion)
Materials: draw a line material may be added to the material for the line drawn, each material will be on the line drawing a rendering
positions: position of the point of drawing lines, at least two, i.e. the line is drawn between the two points which
use World Space: using world coordinates
Loop: check to make the line segment drawn form a closed pattern
Width: drawing lines the width of the curve can be controlled with the variation width of the length of the line segment drawn also change, so that the wire drawn out more diversity.
Color: color line drawing can be set to gradient.
Corner Vertices: The larger the value, the corners rounded objects about
End Cap Vertices: ibid., The larger the value, the rounded ends of draw lines
Alignment: Calibration line drawing (View in the camera as a reference to calibrate itself Local reference calibration)
Texture mode: picture fill mode (stretch, tile ...)
Light Probes: illumination mode
LineRenderer common attributes:
SetColor: set color
SetPosition: the position set point
positionCount: setting the number of vertices
SetStartWidth: set initial width
SetEndWidth: eND width
trailing rendering
Use trailing render component (Trail Renderer) when trailing rendering, rendering to render a kind of pattern game movement locus of the object
to make the object mounted on the tailing effect in which a component object TrailRenderer
assembly with specific attributes Videos line rendering almost
trailing rendering will be made according to Assert Store Daoguang tailing effect among plug-Trail MeleeWeapon
       MeleeWeapon plug Trail

Material: represents the Daoguang tailing effect shaders
LiftTime: duration represents the Daoguang trailing
Base: Dao Guang represent the starting position
Tip: Dao Guang represents the end position
to create two empty trailing in to render objects subobject, were named tip and base. They are used to indicate the end of the trailing end of the Daoguang beginning. The tip is moved to the end of the arms, move the base of the handle end to weapons
textures fused
the two images merge into one picture effect.
Example: bullet effect
principle: to achieve the integration of the two pictures, which is about the pixels of an image into another photo.
1, need two pictures, a wall of pictures, pictures of a bullet to achieve when using the mouse to click a wall picture, click on the position of the center point, the bullet-ridden image of pixels arranged in a wall picture

2. Create Unity project, these two pictures Drag engineering, making the following changes settings
① need to set these two pictures TextureType to Advanced;
② two pictures to be checked on Read / WriteEnable property that allows picture pixels edit;
③ MaxSize is provided bullet image 64, format format: RGBA32 'bit;
④ image MaxSize is disposed wall 2048, format' bit format RGBA32;
. 3, create a scene, directly on the wall bracket Plane image to
the game scene to create a plane, the treated wall picture drag up
4, create a script PlaneScr, implemented using the mouse can generate the corresponding bullet when clicking a wall in a script, the script will mount on Plane

// obtain a strong texture and bullets 
    public the Texture2D bulletTexture;
     public the Texture2D wallTexture; 

    // define a wall copy 
    the Texture2D newWallTexture; 

    // record the width and height of the wall and the bullet 
    a float wall_height;
     a float wall_width;
     a float bullet_height;
     a float bullet_width; 

    // ray collision information 
    RaycastHit hitInfo;
     // define a generic queue to store image pixel information 
    queue <the Vector2> uvQueue; 

the Start field initialization process is 
void Start () 
    { 
        uvQueue = new new queue <the Vector2> ();
         //Gets wall texture 
        wallTexture = GetComponent <MeshRenderer> () .material.mainTexture AS Texture2D;
         // backup for wall restoration 
        newWallTexture = Instantiate (wallTexture);
         // backup pictures assigned to Plane 
        GetComponent <MeshRenderer> () = .material.mainTexture newWallTexture;
         // get the initial width of the wall and the bullet high 
        wall_height = newWallTexture.height; 
        wall_width = newWallTexture.width; 
        bullet_height = bulletTexture.height; 
        bullet_width = bulletTexture.width; 
    }

Write map integration in the Update method results, click on the wall emitting radiation, radiation to the collision     
point as the center, will replace the pixels of the picture bullet holes on the wall 
void Update () 
    { 
        // mouse click         
        IF (the Input. GetMouseButtonDown ( 0 )) { 
            ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
             IF (Physics.Raycast (ray, OUT hitInfo)) {
                 IF (== hitInfo.collider.name " Plane " ) { 
                    the Vector2 UV = hitInfo.textureCoord; 
                    uvQueue.Enqueue (uv); 
                    // illustrate the bullet hit the wall
                     //Start the click point as the center on the wall, pixel regions of the image size into a bullet hole bullet hole pixels
                     // iterate bullet image area, pixels on the image taken bullets 
                    for ( int I = 0 ; I <bullet_width; ++ I ) {
                         for ( int J = 0 ; J <bullet_height; J ++ ) {
                             // get the corresponding pixel of each bullet should appear on the walls of 
                            a float W * = uv.x wall_width - bullet_width / 2 + I;
                             a float H UV = wall_height * .y - bullet_height / 2 + J;
                             // Get color of each pixel of the wall and the bullet
                            WallColor = newWallTexture.GetPixel Color (( int ) W, ( int H)); 
                            Color bulletColor = bulletTexture.GetPixel (I, J);
                             // fusion 
                            newWallTexture.SetPixel (( int ) W, ( int H), wallColor * bulletColor ); 
                        } 
                    } 
                    // fusion picture modified application at 
                    newWallTexture.Apply ();
                     // delay of 3 seconds after 
                    the Invoke ( " ReturnWall " , 3F); 
                }
            } 
        } 

(I.e. the method allows the bullet holes disappear) Recovery wall 
// restore the wall 
    void ReturnWall () 
    { 
        // of a bullet hole in the queue 
        the Vector2 UV = uvQueue.Dequeue ();
         for ( int I = 0 ; I <bullet_width; I ++ ) {
             for ( int J = 0 ; J <bullet_height; J ++ ) {
                 a float W * = uv.x wall_width - bullet_width / 2 + I;
                 a float H * = uv.y wall_height - bullet_height / 2 +J;
                // Get the pixel of the original wall 
                Color wallColor wallTexture.GetPixel = (( int ) W, ( int ) H); 
                newWallTexture.SetPixel (( int ) W, ( int H), wallColor); 
            } 
        } 
        newWallTexture.Apply ( ); 
    }

 

Guess you like

Origin www.cnblogs.com/zpy1993-09/p/11781354.html
09