SteamVR 2.3.2 获取手柄按键状态

承接ARVR外包项目   史小川QQ: 2118590660
ARVR行业交流QQ群:750656715
公众号: ARVR行业领跑者
B站: ARVRinChina

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

public class InputController : MonoBehaviour
{
    // Start is called before the first frame update

    public Hand hand;
  
    // Start is called before the first frame update
    void Start()
    {

    }

    private void OnEnable()
    {
        if (hand == null)
        {
            hand = this.GetComponent();
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (SteamVR_Input.GetState("default", "interactUI", hand.handType))
        {

            Debug.Log("interactUI");
        }
        //自定义按键
        if (SteamVR_Input.GetState("custom", "RayHide", hand.handType))
        {
            Debug.Log("RayHide");
        }

        if (SteamVR_Input.GetState("custom", "TouchPad", hand.handType))
        {
            Debug.Log("TouchPad");
        }

    }

}

你可能感兴趣的:(ARVR,HTC-Vive)