2019年3月26日 星期二

Week06 光

試著用Treesize看匯入Unity的資源大小
選擇steamVR plugin要匯入的部分



程式碼:
按下Trigger 得到Trigger的數值
按下Trigger 製造一顆球
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;
       float x=0;

       bool state=false;
       void Update()
       {
               if(myTrigger.GetState(SteamVR_Input_Sources.Any)   ){
                     if(state==false){                   
                     print("yes");
                     GameObject now = Instantiate(mySphere);
                     //now.transform.position = new Vector3(x,0,0);
                     //x++;
                     now.transform.position = myController.transform.position;
                     }else{
                           state=false;
                     }
               }
       }
}



Week07 李宜謙

寫出按下扣板機就會印出yes

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;//自己寫的
public class mycode : MonoBehaviour
{
public SteamVR_Action_Boolean trigger;///按下按鈕出現數值
// Start is called before the first frame update
void Start()
{

}
// Update is called once per frame
void Update()
{
if (trigger.GetState(SteamVR_Input_Sources.Any)
{
print("yes");///當手把按下按鈕出現yes
}
}
}
按下扣板機會不斷生成球
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;//自己寫的
public class mycode : MonoBehaviour
{
public SteamVR_Action_Boolean trigger;///按下按鈕出現數值
public GameObject mySphere;
// Start is called before the first frame update
void Start()
{

}
FLOAT X=0;
// Update is called once per frame
void Update()
{
if (trigger.GetState(SteamVR_Input_Sources.Any)
{
print("yes");///當手把按下按鈕出現yes
}
GameObject now= Instantiate(mySphere);
now.transform.position =new Vector3(x,0,0);
偵測手把位置並在偵測處生成出一顆球
}
}
比較可惜的是我們小組始終沒有成功


Week06-04160453

講解期末作品細節
  1如何企劃期中作品企劃&準備期末作品實作
  2期末作品展示,評分
  3
看去年的VR battle作品影片
  4
介紹作品如何逐步做出來

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("");
            }







Week06

老師上課逐步講解程式

新增cameraRig
手把放置球球

week06_葉子瑄

1.今天老師利用較簡單的程式交我們理解運作
2.首先先下載好visual stdio code
3.要在unity裡面下載steamvr pluging
4.然後把camerarig拉到hierarchy
5.到window下載steamvr input設定手把按鈕,會跳到網頁作設定(chrome比較好)

6.寫程式碼(好像是手把的問題,是很多次沒有成功)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;//自己寫的
public class mycode : MonoBehaviour
{
public SteamVR_Action_Boolean trigger;///按下按鈕出現數值
// Start is called before the first frame update
void Start()
{
}

// Update is called once per frame
void Update()
{
if (trigger.GetState(SteamVR_Input_Sources.Any)){
print("yes");///當手把按下按鈕出現yes
}
}
}

7.

week06

寫出按下扣板機就會印出yes

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;//自己寫的
public class mycode : MonoBehaviour
{
public SteamVR_Action_Boolean trigger;///按下按鈕出現數值
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (trigger.GetState(SteamVR_Input_Sources.Any)
{
print("yes");///當手把按下按鈕出現yes
}
}
}

按下扣板機會不斷生成球
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;//自己寫的
public class mycode : MonoBehaviour
{
public SteamVR_Action_Boolean trigger;///按下按鈕出現數值
public GameObject mySphere;
// Start is called before the first frame update
void Start()
{
}
FLOAT X=0;
// Update is called once per frame
void Update()
{
if (trigger.GetState(SteamVR_Input_Sources.Any)
{
print("yes");///當手把按下按鈕出現yes
}
GameObject now= Instantiate(mySphere);
now.transform.position =new Vector3(x,0,0);
}
}

偵測手把位置並在偵測處生成出一顆球



Week06_珮妤的筆記


下載&import Steam VR 匯入需要的就好

讓手把變出球
using System.Collections;

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

public class MyScript : MonoBehaviour
{
    public SteamVR_Action_Boolean triggerDown;
    // Start is called before the first frame update
    public GameObject mysphere; 
    public GameObject myController;
    bool state=false; 
  
    void Update()
    {
        if(triggerDown.GetState(SteamVR_Input_Sources.Any))
        {
            if(state==false)
            {
                state=true;

                print("triggerDown");

            GameObject now=Instantiate(mysphere);
            //now.transform.position = new Vector3(x,0,0); 
            //x++;
            now.transform.position=myController.transform.position;
            }
        }
        else
        {
            state=false;
        }
    }    
}