Skip to content

Instantly share code, notes, and snippets.

@unity3dcollege
Created August 14, 2017 23:19
Show Gist options
  • Save unity3dcollege/6b097fb4163abf6e6d36b33ff0d48776 to your computer and use it in GitHub Desktop.
Save unity3dcollege/6b097fb4163abf6e6d36b33ff0d48776 to your computer and use it in GitHub Desktop.
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