zoukankan      html  css  js  c++  java
  • 关于Unity中粒子效果的使用

    粒子效果
    1: 游戏中会有很炫酷的特效,比如爆炸,水花,火焰等;
    2: unity提供粒子编辑器,方便特效人员来开发很炫酷的特效;
    3.粒子效果一般有专门的粒子特效师来做,我们只需要拿来用就好了,很多参数没必要掌握。

    Particle System组件面板

    1: 粒子系统主体;
    2: 喷射(Emission);
    3: 形态(shape);
    4: 生命周期内的速度偏移(velocity over lifetime);
    5: 生命周期内的限制速度(limit velocity over lifetime);
    6: 生命周期内的受力偏移(Force velocity over lifetime);
    7: 生命周期内的颜色(Color velocity over lifetime);
    8:颜色随速度的变化(Color by Speed);
    9: 生命周期内的大小(Size over lifetime);
    10: 大小随速度变化(Size by speed);
    11: 生命周期内的转速(Rotation over lifetime);
    12: 角速度随速度变化(Rotation by Speed);
    13: 外部作用力(External Forces)
    14: 碰撞(Collision)
    15: 子发射系统(Sub Eimitters);
    16: 纹理层动画(Texture Sheet Animation);
    17: 渲染器(Render);

    Node属性板

    1: Duration: 粒子喷射周期;
    2: Looping: 是否循环喷射;
    3: Prewarm: 预热(Loop状态下预产生下一周期的粒子);
    4: StartDelay: 粒子喷射延迟,Prewarm无法延迟;
    5: Start Lifetime: 粒子生命周期;
    6: Start speed: 粒子喷射速度;
    7: Start Rotation: 粒子大小;
    8: Start Color: 粒子颜色;
    9: Gravity Modifier: 相对与重力加速的的重力密度(缩放比);
    10: Inherit Velocity: 新生粒子的继承速度;
    11: Simulation Space: 粒子系统的模拟空间;
    12: Play On Awake: 是否在加载的时候播放;
    13: MaxParticles: 一周内发射的例子数,多与此数目停止发射

    Shape属性板

    1:决定了例子系统喷射的范围;
    2: 主要的形状有:
    球体(Sphere) 半球体(HemiSphere)
    圆锥体 Cone, 盒子(Box)
    网格(Mesh) 环形(Cricle) 边线(Edge)

    Renderer属性板

    创建步骤

    1: 创建Unity项目

    2: 创建一个粒子

    (1) GameObject--> Particle System;

    (2) 创建一个节点-->添加一个ParticleSystem组件;

    导入和使用

    1: 创建Unity项目

    2.import package---->Cuostom package---->partycle.unitypackage

    3.把预制体Tree拖进节点视图中

    4.创建一个脚本test_particle挂载到Tree节点下,通过代码控制粒子属性和进行操作

    5.test_particle脚本内容如下:

    using UnityEngine;
    using System.Collections;
    
    public class test_particle : MonoBehaviour {
        ParticleSystem ps;
        // Use this for initialization
        void Start () {
            this.ps = this.GetComponent<ParticleSystem>();
            Debug.Log(this.ps.duration);
            this.Invoke("play_particle", 5);
        }
    
        void play_particle() {
            this.ps.Play();
        }
    
        // Update is called once per frame
        void Update () {
            if (Input.GetKeyDown(KeyCode.Space)) {
                if (this.ps.isPaused)
                {
                    this.ps.Play();
                }
                else {
                    this.ps.Pause();
                }
            }
            if (Input.GetKeyDown(KeyCode.S)) {
                if (this.ps.isStopped) {
                    this.ps.Play();
                }
                else {
                    this.ps.Stop();
                }
            }
        }
    }
  • 相关阅读:
    jQuery笔记之工具方法—Ajax 优化回调地狱
    jQuery笔记之工具方法—高级方法Ajax
    jQuery笔记之 Ajax回调地狱
    jQuery笔记之工具方法extend插件扩展
    jQuery同时监听两个事件---实现同时操控两个按键
    jQuery笔记之工具方法
    肖sir_多测师 _高级讲师 第二个月21讲解jmeter性能测试之安装badboy(002)
    肖sir_多测师 _高级讲师 第二个月21讲解jmeter之实战性能测试(001)
    肖sir_多测师 _高级讲师 第二个月20讲解jmeter之实战操作mysql(004)
    肖sir_多测师 _高级讲师 第二个月20讲解jmeter接口之实战(003)
  • 原文地址:https://www.cnblogs.com/HangZhe/p/7219778.html
Copyright © 2011-2022 走看看