Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
chadstitch's avatar
chadstitch
Explorer
7 years ago

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!

10 Replies

Replies have been turned off for this discussion
  • 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)

  • 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?

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

  • 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? 
  • correct, that should return you a 0-1 value to work with

  • 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!
  • You could always just cast as a bool, thought you'l lose the analog functionality of the triggers

  • 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!



  • 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).