cancel
Showing results for 
Search instead for 
Did you mean: 

How do you detect Touch button and Trigger presses?

nerdVRBuddy
Protege
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?
1 ACCEPTED SOLUTION

Accepted Solutions

juanoldinho
Heroic Explorer
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-touc...


View solution in original post

4 REPLIES 4

juanoldinho
Heroic Explorer
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-touc...


nerdVRBuddy
Protege
Thanks for the Info. Very nice

JVVince
Honored Guest
@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.