乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      6.6 粒子特效

       雪柳花明 2016-04-13
      一、粒子特效
      粒子效果的原理是將若干粒子無規(guī)則地組合在一起,用來模擬火焰、爆炸、水滴、霧氣等效果。


      創(chuàng)建粒子對象:Hierachy視圖點擊create----》particle system即可。創(chuàng)建好粒子對戲?qū)ο蠛螅纯稍趕cene視圖中編輯該粒子對象的位置。

      二、粒子發(fā)射器
      粒子發(fā)射器用于設(shè)定粒子的發(fā)射屬性,比如粒子的大小、數(shù)量和速度。在hierarchy視圖中選擇剛剛創(chuàng)建的粒子對象,在右側(cè)的Inspector視圖中可以看到粒子發(fā)射器的所有屬性。

       
       
      三、粒子動畫
      粒子動畫用于設(shè)定粒子渲染中的動畫效果。動畫效果的種類繁多,比如動畫的顏色、拉伸的比例、拉伸的速度、等
      粒子動畫的屬性
       
       四、粒子渲染器
      粒子渲染器主要用于粒子的渲染,比如粒子渲染模式,粒子的縮放、粒子的尺寸。

      粒子渲染器中各個選項的具體含義。
       
       

      五、粒子效果實例
      Unity提供了粒子標(biāo)準(zhǔn)資源包,其中包含了很多非常棒的粒子資源。

      下述代碼中,首先在start方法中使用find方法獲取當(dāng)前粒子效果的游戲?qū)ο?,然后繼續(xù)調(diào)用particleEmitter引用拿到當(dāng)前粒子效果的發(fā)射器對象,最后根據(jù)發(fā)射器對象來編輯粒子效果。

      代碼有誤:MissingComponentException: There is no 'ParticleEmitter' attached to the "ParticleSystem" game object, but a script is trying to access it.

      using UnityEngine;
      using System.Collections;

      public class particle : MonoBehaviour {
      //例子對象
      GameObject particles=null;
      //粒子在x軸方向的速度
      float velocity_x=0.0f;
      //粒子在y軸方向的速度
      float velocity_y=0.0f;
      //粒子在z軸方向的速度
      float velocity_z=0.0f;

      // Use this for initialization
      void Start () {
      particles=GameObject.Find("ParticleSystem");
      }
      void OnGUI()
      {
      //通過拖動設(shè)置粒子的最大尺寸
      GUILayout.Label("粒子最大尺寸");
      particles.GetComponent<ParticleEmitter>().maxSize=GUILayout.HorizontalSlider(particles.GetComponent<ParticleEmitter>().maxSize,0.0f,10.0f,GUILayout.Width(150));
      this.gameObject.GetComponent<ParticleSystem>().enableEmission=true;
      particles.AddComponent<ParticleEmitter>();
      //通過拖動設(shè)置粒子的最大消失時間
      GUILayout.Label("粒子消失時間");
      particles.GetComponent<ParticleEmitter>().maxEnergy=GUILayout.HorizontalSlider(particles.GetComponent<ParticleEmitter>().maxEnergy,0.0f,10.0f,GUILayout.Width(150));

      //通過拖動設(shè)置粒子的最大生成數(shù)量
      GUILayout.Label("粒子的最大生成數(shù)量");
      particles.GetComponent<ParticleEmitter>().maxEmission=GUILayout.HorizontalSlider(particles.GetComponent<ParticleEmitter>().maxEmission,0.0f,10.0f,GUILayout.Width(150));

      //拖動設(shè)置x軸的移動速度
      GUILayout.Label("粒子x軸的移動速度");
      velocity_x=GUILayout.HorizontalSlider(velocity_x,0.0f,10.0f,GUILayout.Width(150));
      particles.GetComponent<ParticleEmitter>().worldVelocity=new Vector3(velocity_x,particles.GetComponent<ParticleEmitter>().worldVelocity.y,particles.GetComponent<ParticleEmitter>().worldVelocity.z);

      //拖動設(shè)置y軸的移動速度
      GUILayout.Label("粒子y軸的移動速度");
      velocity_y=GUILayout.HorizontalSlider(velocity_y,0.0f,10.0f,GUILayout.Width(150));
      particles.GetComponent<ParticleEmitter>().worldVelocity=new Vector3(particles.GetComponent<ParticleEmitter>().worldVelocity.x,velocity_y,particles.GetComponent<ParticleEmitter>().worldVelocity.z);

      //拖動設(shè)置z軸的移動速度
      GUILayout.Label("粒子z軸的移動速度");
      velocity_z=GUILayout.HorizontalSlider(velocity_z,0.0f,10.0f,GUILayout.Width(150));
      particles.GetComponent<ParticleEmitter>().worldVelocity=new Vector3(particles.GetComponent<ParticleEmitter>().worldVelocity.x,particles.GetComponent<ParticleEmitter>().worldVelocity.y,velocity_z);

      }
      // Update is called once per frame
      void Update () {
      }
      }






        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多