May 2018
Beginner
492 pages
11h 53m
English
If you have a VR device supported by OpenVR (HTC Vive, Oculus Rift, or Windows MR), let's modify the ButtonTest function to check for a pull and release of the trigger button.
To implement this, we need to provide our script with the specific input component that we want to query. In OpenVR, this is represented by the SteamVR_TrackedObject component, as shown in the following variation of our script:
public class MyInputController : MonoBehaviour { public SteamVR_TrackedObject rightHand; private SteamVR_Controller.Device device; void Update () { ButtonTest(); } private void ButtonTest() { string msg = null; // SteamVR device = SteamVR_Controller.Input((int)rightHand.index); if (device != null && device.GetPressDown(SteamVR_Controller.ButtonMask.Trigger)) ...Read now
Unlock full access