Skip to main content
Participant
August 26, 2019

Unity XR Oculus Touch Input Inquiry

Hi there, I am trying to use Unity XR to test an application.

However, there is one key difference with using Oculus that I find quite annoying, and am trying to figure out a possible solution!

I am able to get input working, however when I'm pressing the trigger button, this applies to Unity XR specifically, only a TOUCH is required, and not a press.

Source from https://docs.unity3d.com/Manual/OpenVRControllers.html at the bottom, titled Important Controller Differences


The Event System generates Input Touch events for the triggers on Oculus Touch and Valve Knuckles controllers when Unity Input detects a touch - no trigger squeeze is necessary.

As you can see stated, the Event System will send an input touch even on touch. However, this is NOT the implementation I want, and would rather have it regularly. If anyone has any idea of how I could do this, it would be greatly appreciated, thank you!
    This topic has been closed for replies.

    10 replies

    Inspiring
    August 26, 2019
    How is your input configured currently? It sounds like you're querying the cap sensor (bool) on the index trigger instead of the trigger (0-1)
    Participant
    August 26, 2019

    MikeF said:

    How is your input configured currently? It sounds like you're querying the cap sensor (bool) on the index trigger instead of the trigger (0-1)


    Hi thanks for replying! I'm using like 
    OvrInput.GetDown(GetButtonMap(button), Controller)

    Where GetButtonMap(button) returns a virtual mask and Controller, is the controller is was pressed on.

    So at the moment, what happens is things like a,b,x,y buttons all works as intended as buttons.

    However, if I move to using the trigger, it queries it as touch. Now unfortunately, it seems that this is intended for now?

    Inspiring
    August 26, 2019
    you're returning a bool rite now, try this
    float IndexTrigger_Value = OVRInput.Get(OVRInput.Axis1D.PrimaryIndexTrigger, controller);
    Participant
    August 26, 2019

    MikeF said:

    you're returning a bool rite now, try this
    float IndexTrigger_Value = OVRInput.Get(OVRInput.Axis1D.PrimaryIndexTrigger, controller);


    Interesting, so I guess I would want to ideally query for a float value, and check if it passes some threshold? 
    Inspiring
    August 26, 2019
    correct, that should return you a 0-1 value to work with
    Participant
    August 26, 2019

    MikeF said:

    correct, that should return you a 0-1 value to work with


    Okay thanks! I suppose that is unfortunate, for my use case, as I am wanting to develop for potentially different platforms, and Oculus would have to be handled differently because before I could just have the button press and not worry about the touch. Oh well.

    Thanks though!
    Inspiring
    August 26, 2019
    You could always just cast as a bool, thought you'l lose the analog functionality of the triggers
    Participant
    August 26, 2019

    MikeF said:

    You could always just cast as a bool, thought you'l lose the analog functionality of the triggers


    Appreciate the help a lot!
    Inspiring
    August 26, 2019
    no problem, happy to help :)
    kojack
    Honored Contributor
    August 29, 2019



    MikeF said:

    You could always just cast as a bool, thought you'l lose the analog functionality of the triggers


    Appreciate the help a lot!



    One little note: C# doesn't have implicit or explicit casts to bools. You can use the Convert.ToBoolean(). Usually for a trigger its better to explicitly give it an activation point such as 0.5f. If you don't want to use an if statement for that:
    bool triggerPress = Convert.ToBoolean((int)(triggerValue+(1.0f-activationPoint)));
    where activationPoint is the floating point value where you register the trigger as a button press (like 0.8f meaning you need to pull the trigger in 80% before it acts as a button press).

    Author: Oculus Monitor , Auto Oculus Touch , Forum Dark Mode , Phantom Touch Remover , X-Plane Fixer Hardware: Threadripper 1950x, MSI Gaming Trio 2080TI, Asrock X399 Taich Headsets: Wrap 1200VR, DK1, DK2, CV1, Rift-S, GearVR, Go, Quest, Quest 2, Reverb G2, Quest 3