Skip to main content
Inspiring
May 26, 2017
Solved

How do you detect Touch button and Trigger presses?

  • May 26, 2017
  • 4 replies
  • 35684 views
I'm a beginner. Not great scripter. just a hobby. But i got Touch controllers and Unity and I want to detect user pressing buttons or the triggers for a little game i'm making.

How do i go about it?   I already figured out how to get the Oculus Touch controllers in my game. But i don't know anything about how to detect buttons and triggers.


I have in the past figured out how to detect button presses in the XBOX controller. Is it similar way?
This topic has been closed for replies.
Best answer by juanoldinho
Hi,

There are a couple different methods to detect button presses.
// returns true if the primary button (typically “A”) is currently pressed.
OVRInput.Get(OVRInput.Button.One);

You may also specify a controller 
// returns true if the "A" button is pressed on the Right Touch Controller.
OVRInput.Get(OVRInput.Button.One, OVRInput.Controller.RTouch);

To detect trigger presses:
// returns a float of the Hand Trigger’s current state on the Left Oculus Touch controller.
OVRInput.Get(OVRInput.Axis1D.PrimaryHandTrigger, OVRInput.Controller.LTouch);

The rest of documentation can be found here:
https://developer.oculus.com/documentation/unity/latest/concepts/unity-ovrinput/#unity-ovrinput-touch


4 replies

Participant
May 26, 2017
Hi,

There are a couple different methods to detect button presses.
// returns true if the primary button (typically “A”) is currently pressed.
OVRInput.Get(OVRInput.Button.One);

You may also specify a controller 
// returns true if the "A" button is pressed on the Right Touch Controller.
OVRInput.Get(OVRInput.Button.One, OVRInput.Controller.RTouch);

To detect trigger presses:
// returns a float of the Hand Trigger’s current state on the Left Oculus Touch controller.
OVRInput.Get(OVRInput.Axis1D.PrimaryHandTrigger, OVRInput.Controller.LTouch);

The rest of documentation can be found here:
https://developer.oculus.com/documentation/unity/latest/concepts/unity-ovrinput/#unity-ovrinput-touch


Please tag me, @juanoldinho, in your forum post/response if you need immediate assistance or want additional support or context on an issue you are having with our software or integrations. Having an issue with our platform, services, or integrations? Try using our new bug tool to report this and receive emailed updates as we proceed to address it internally.
Inspiring
May 27, 2017
Thanks for the Info. Very nice
New Participant
June 28, 2018
@nerdVRBuddy
First sorry for comment a question inside your thread. I'm facing the same problem so I think to post here will be easier to follow.
@juanoldinho
Hi juanoldinho, I go around the internet, read all the documentation that you gave (I through it before) and I tried all but not thing help. My touch controller has only recognized the touch event and when I press the button, nothing work.
Here is my environment:
My project is not using HMD so I set the camera target eye to None. OVRManager gameobject set. I'm using unity 2018.1.6f1 and Oculus Util Plugin 1.25.0. 
Please support me. 
Participant
July 2, 2018