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);
               publi

posted @ 2018-10-26 18:28  AEOK  阅读(245)  评论(0编辑  收藏  举报