SteamVR 플러그인 2.0 InteractionSystem 시나리오 방법 새 키 핸들

SteamVR 입력을 개방하는 첫번째 단계

두 번째 단계는 추가 버튼 이벤트를 클릭

세 번째 단계는 우리가 다음과 같은 주요 트리거 핸들을 설정 한 경우 재산 관련 이벤트를 설정하는 것입니다

단계 4 개는 저장을 클릭하고 잠시 동안 약간의 대기를 생성합니다. 그런 다음 열기 바인딩 UI를 클릭합니다

팝업 페이지 후 핸들을 구성하는 데 사용됩니다.

 

 

 

그리고 핸들에 연결된 코드를 추가

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;
using Valve.VR.InteractionSystem;
//这个脚本要挂到RightHand手柄上
public class TestScript : MonoBehaviour
{
    public SteamVR_Action_Boolean tigger;//握持键
    Hand hand;//一定要确保有Hand 脚本
    // Start is called before the first frame update
    void Start()
    {
        hand = GetComponent<Hand>();
    }

    // Update is called once per frame
    void Update()
    {
        if (hand)
        {
            if (tigger.GetStateDown(hand.handType))//按下
            {
                Debug.Log("tigger");
            }
        }
       
    }
}

에 클릭

호출되는 트리거, 우리는이를 선택한

그런 다음 트리거가 일치를 실행 누르십시오

성공! ! !

추천

출처blog.csdn.net/qq_34581781/article/details/89082459