8 using UnityEngine.Events;
10 namespace Valve.VR.InteractionSystem
13 [RequireComponent( typeof( Interactable ) )]
16 public UnityEvent onTriggerDown;
17 public UnityEvent onTriggerUp;
18 public UnityEvent onGripDown;
19 public UnityEvent onGripUp;
20 public UnityEvent onTouchpadDown;
21 public UnityEvent onTouchpadUp;
22 public UnityEvent onTouchpadTouch;
23 public UnityEvent onTouchpadRelease;
28 for (
int i = 0; i < Player.instance.handCount; i++ )
30 Hand hand = Player.instance.GetHand( i );
32 if ( hand.controller != null )
34 if ( hand.controller.GetPressDown( Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger ) )
36 onTriggerDown.Invoke();
39 if ( hand.controller.GetPressUp( Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger ) )
44 if ( hand.controller.GetPressDown( Valve.VR.EVRButtonId.k_EButton_Grip ) )
49 if ( hand.controller.GetPressUp( Valve.VR.EVRButtonId.k_EButton_Grip ) )
54 if ( hand.controller.GetPressDown( Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad ) )
56 onTouchpadDown.Invoke();
59 if ( hand.controller.GetPressUp( Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad ) )
61 onTouchpadUp.Invoke();
64 if ( hand.controller.GetTouchDown( Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad ) )
66 onTouchpadTouch.Invoke();
69 if ( hand.controller.GetTouchUp( Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad ) )
71 onTouchpadRelease.Invoke();