2019年3月26日 星期二

Week 06

1.vr比賽,(校內+校外)(元智大學沒有獨立顯卡的整間教室,所以在銘傳S405)

2.Week06教學內容
  1)如何企劃期中作品企劃(&準備期末作品實作)
  2)期末作品展示/評分/競賽
  3)Computer Graphics Workshop 的VR Battle
  4)看去年的VR battle作品影片
  5)重點:介紹作品如何逐步做出來
  6)
  7)

3.學長ppt學習——全台灣教VR老師都是教unity老師,作品都是還模型和皮膚
  1)steam VR Plugin 僅放入需要的檔案
  2)steam VR input 記得存檔
  3)Grabpinch(扣動扳機)
  4)程式碼如何運作的
  5)生成需要的模型(食指扣下去)

4.上課步驟
  1)vive硬體/軟體更新(steam VR update)—— 一定要更新
  2)unity 2018開啟,Asset; Steam VR
  3)TODO:做一個小畫家
5.定位器base station
—— 不使用傳輸線的時候用BC,使用的時候用AB

學長的code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Value.VR;

public class ViveInput : MonoBehaviour {

       public Steam_Action_Boolean triggerDown;
       public Steam_Action_Vibration hapticAction;
       public Steam_Action_Single squeezeAction;
       public Steam_Action_Vector2 touchpadTouch;

      void Update(){

             if (triggerDown.GetState(SteamVR_Input_Sources.Any))
             {
                 hapticAction.Execute(0, 1, 150, 75, SteamVR_Input_Sources.LeftHand);
                 print("triggerDown");
             }

             float triggerValue = squeezeAction.GetAxis (SteamVR_Input_Sources.Any);
             Vector2 padPods = touchpadTouch.GetAxis (SteamVR_Input_Sources.Any);
   
             if (triggerValue > 0.0f)
            {
                 print("");
            }

6.實作
  1)開啟unity
  2)download Treesize—— 查看文件夾詳細大小
  3)更新SteamVR Plugin全部匯入後浪費空間和時間(不是全部需要)
  4)安裝VS code
  5)
coding 1:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;                                                                                //這行是自己寫的

public class myCode : MonoBehaviour
{
       public SteamVR_Action_Boolean myTrigger;
       void Start()
       {

       }
       void Update()
       {
           if( myTrigger.GetState(SteamVR_Input_Sources.Any)){   //這行是自己寫的
                print("yes");                                                                    //這行是自己寫的
           }
       }
}

coding 2:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;                                                                                //這行是自己寫的

public class myCode : MonoBehaviour
{
       public SteamVR_Action_Boolean myTrigger;         //這行是自己寫的
       public GameObject mySphere;                                 //這行是自己寫的,可自己拉放好它         
       public GameObject myController;                            //now

       void Start()
       {

       }

       //float x = 0;
       bool state = false;      // not pass
       void Update()
       {
           if ( myTrigger.GetState(SteamVR_Input_Sources.Any)){      //這行是自己寫的
               if ( state == false ){                             //只會進來一次
                     state = true;              
                     print("yes");                                                                    //這行是自己寫的
                     GameObject now = Instantiate(mySphere);                   //這行是自己寫的
                     //now.transform.position = new vector3(x,0,0);
                     //x++;
                     now.transform.position = myController.transform.position;              
               }
           }
        }else{
               state = false;                                       //清空
       }
}


7.看之前學長姐的作品企劃書,學習寫企劃書(感覺和專題計畫類似)
   三份高分企劃書(在moodle)
   下下週二早上九點繳交企劃書


沒有留言:

張貼留言