Created
August 14, 2017 23:19
-
-
Save unity3dcollege/6b097fb4163abf6e6d36b33ff0d48776 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class TriggerTester : MonoBehaviour | |
{ | |
private SteamVR_TrackedObject trackedObject; | |
[SerializeField] | |
private bool trigger; | |
[SerializeField] | |
private bool trackpad; | |
[SerializeField] | |
private bool grip; | |
[SerializeField] | |
public bool menu; | |
private void Start() | |
{ | |
trackedObject = GetComponent<SteamVR_TrackedObject>(); | |
} | |
private void Update() | |
{ | |
var device = SteamVR_Controller.Input((int)trackedObject.index); | |
trigger = device.GetPress(Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger); | |
grip = device.GetPress(Valve.VR.EVRButtonId.k_EButton_Grip); | |
trackpad = device.GetPress(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad); | |
menu = device.GetPress(Valve.VR.EVRButtonId.k_EButton_ApplicationMenu); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment