using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using VRTK; public class VRInputTest : MonoBehaviour { Transform currentTrans; // Start is called before the first frame update void Start() { GetComponent().TouchpadAxisChanged += new ControllerInteractionEventHandler(DoTouchpadPressed); GetComponent().TouchpadTouchEnd += new ControllerInteractionEventHandler(DoTouchpadReleased); GetComponent().TriggerClicked += TriggerClicked; GetComponent().ButtonTwoPressed += LittleButtonClick; GetComponent().DestinationMarkerHover += DestinationMarkerHover; GetComponent().PointerStateInvalid += PointerInValid; GetComponent().PointerStateValid += PointerValid; } private void LittleButtonClick(object sender, ControllerInteractionEventArgs e) { Debug.Log("小按钮按下"); } // private void PointerValid(object sender, DestinationMarkerEventArgs e) { Debug.Log(e.target.name); } // private void PointerInValid(object sender, DestinationMarkerEventArgs e) { Debug.Log("无碰撞物体"); } // private void DestinationMarkerHover(object sender, DestinationMarkerEventArgs e) { } // private void TriggerClicked(object sender, ControllerInteractionEventArgs e) { Debug.Log( GetComponent().IsPointerActive());//判断射线是否存在 } // private void DoTouchpadPressed(object sender, ControllerInteractionEventArgs e) { //throw new NotImplementedException(); } // private void DoTouchpadReleased(object sender, ControllerInteractionEventArgs e) { //throw new NotImplementedException(); } // Update is called once per frame void Update() { } }