VR手柄控制

using UnityEngine;  
using System.Collections;  
//檢測手柄功能的腳本 這個腳本掛到手柄上(controler(right)和controler(left))上  
public class ButtonTouchAction : MonoBehaviour {  
    //手柄  
    SteamVR_TrackedObject trackdeObjec;  
 
    void Awake() {  
        //獲取手柄上的這個組件  
        trackdeObjec = GetComponent<SteamVR_TrackedObject>();  
    }  
    // Use this for initialization  
    void Start () {     
    }  
    void FixedUpdate()  
    {   //獲取手柄輸入  
        var device = SteamVR_Controller.Input((int)trackdeObjec.index);  
        //如下是api中複製出來的按鍵列表  
        /*       public class ButtonMask
           {
               public const ulong System = (1ul << (int)EVRButtonId.k_EButton_System); // reserved
               public const ulong ApplicationMenu = (1ul << (int)EVRButtonId.k_EButton_ApplicationMenu);
               public const ulong Grip = (1ul << (int)EVRButtonId.k_EButton_Grip);
               public const ulong Axis0 = (1ul << (int)EVRButtonId.k_EButton_Axis0);
               publiapi

相關文章
相關標籤/搜索