Skip to content

Instantly share code, notes, and snippets.

@hon454
Last active December 28, 2017 11:57
Show Gist options
  • Save hon454/83b54708ee066e44af4d0b68a6862f02 to your computer and use it in GitHub Desktop.
Save hon454/83b54708ee066e44af4d0b68a6862f02 to your computer and use it in GitHub Desktop.
[SteamVR][Unity] Get vive controller trigger full down/click
using UnityEngine;
using Valve.VR;
public class SteamVR_GetControllerTriggerFullDown : MonoBehaviour
{
public SteamVR_TrackedObject Controller;
private void Update ()
{
SteamVR_Controller.Device controllerDevice = null;
if (Controller.isValid)
controllerDevice = SteamVR_Controller.Input((int)Controller.index);
if (controllerDevice != null)
{
if (controllerDevice.GetAxis(EVRButtonId.k_EButton_SteamVR_Trigger).x >= 1.0f)
{
Debug.Log("Controller trigger is full down!!");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment