Last active
December 28, 2017 11:57
-
-
Save hon454/83b54708ee066e44af4d0b68a6862f02 to your computer and use it in GitHub Desktop.
[SteamVR][Unity] Get vive controller trigger full down/click
This file contains 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; | |
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