Search Unity

Question XR Select Action not being triggered when using Value/Axis and Press Interaction

Discussion in 'XR Interaction Toolkit and Input' started by Rigaro, Feb 22, 2021.

  1. Rigaro

    Rigaro

    Joined:
    Dec 4, 2017
    Posts:
    4
    'm trying to get a custom hardware device to work as a "grip" button in an XR application. I have tested the InputDevice and it registers in the input system correctly and can debug its input.



    I'm looking to use the AxisControl in this custom InputDevice to trigger the "Select" action of the default input mappings in the XR Interaction Toolkit by using a Value/Axis action with a Press Interaction. This with the purpose of using this custom device to trigger Direct Interactions.

    I have tried substituing the Default mappings:


    And also updating the mapping directly in the XR Controlle object (done these separately):


    However, the Select Action does not trigger no matter what I do. The OnHoverEntered event triggers when a GrabInteractable object enteres the DirectInteractor, but not the OnSelectEntered when the input from my custom device (gripAction) passes the threshold.

    As I was testing this hardcoding values in the "gripAction" it sometimes worked when the default Press Interaction was selected, but it does not work anymore...

    Any suggestions?
     
  2. Rigaro

    Rigaro

    Joined:
    Dec 4, 2017
    Posts:
    4
    Ok, so I updated the Package and added an InputActionAsset.Enable() and now it registers the AxisControl from my custom device. However, the Press Interaction is triggered for non-zero values in the AxisControl from the input device...
     
  3. chris-massie

    chris-massie

    Unity Technologies

    Joined:
    Jun 23, 2020
    Posts:
    231
    There was a bug in the XR Interaction Toolkit where it only handled button style InputActions that were to a ButtonControl. It did not handle AxisControl types correctly. So for example, binding to
    gripPressed
    on an Oculus Touch Controller would work, but not
    grip
    . The
    IsPressed
    method being called by
    UpdateInput
    in
    ActionBasedController
    was not calculating it correctly in all scenarios.

    This should be fixed in the upcoming 1.0.0-pre.4 version of the package, however with only partial support for some Interactions on the Action or Binding when using Input System 1.0.2. A newer preview release of Input System made some changes to the Interactions and phases of an InputAction, and allows for full support for Interactions when used in XR Interaction Toolkit. With the current verified 1.0.2 version of Input System, you'll need to set the
    ActionBasedController.buttonPressPoint
    to control the press point instead of using the Press Point property on the Press Interaction for those actions set on the XR Controller (Action-based).

    Additionally, that
    IsPressed
    method was made protected virtual to allow users to override it.
     
    otto_pl likes this.
  4. yarsrvenge

    yarsrvenge

    Joined:
    Jun 25, 2019
    Posts:
    87
    Hi Chris,

    I am trying to get the select action to only trigger on index controllers when grip force is greater than a certain value. This is required on the knuckles controllers for things like toggle grab so it is not too easy to activate the select or deselect.

    I have added a gripforce path/binding for Index controllers under the Select action with a press point for the desired pressure along with standard grip actions for the other types of controllers, but it is not working properly no matter what I set the type to with the select action. If I read the value in code it appears to work ok? Is there some magic combination to get this to work with gripforce on index and regular grip for other controllers under my SELECT action? It appears the XR toolkit is using InutActionPhase.performed for recognizing button as pressed.

    I am using XR Toolkiit 1.00-pre8 and the latest input system 1.20.
     
  5. yarsrvenge

    yarsrvenge

    Joined:
    Jun 25, 2019
    Posts:
    87
    I've continued working on this and found that when I have multiple bindings for SELECT including generic XR controllers, they are also getting triggered which prevents the gripforce from being the only one to act on an index controller when the press point is greater than 0.5. I am not sure how to prevent generic XR controller GRIP binding from being triggered when an Index controller is present. I only want index controllers to use the GRIPFORCE binding.

    I assume the intended way is to use a control scheme, but if I understand correctly they will still all be triggered. I'll keep digging through it, but I would assume someone else using OpenXR has had to deal with handling press points for Index controllers so grip is not triggered so easily.
     
  6. yarsrvenge

    yarsrvenge

    Joined:
    Jun 25, 2019
    Posts:
    87
    So, I resolved this but thought I would share how I handled it. Not sure it is the best way. Bottom line, I needed to base the SELECT input action on INDEX controllers using grip force while also allowing regular grip for other XR controllers. Whenever I added that under the select action along with other generic XR controller bindings it did not work correctly. Basically, the grip pressure and grip were reported as one value and it was always 0 or 1.

    To solve this, I created a new control scheme just for Index controllers. The problem is it won't just automatically use that control scheme, so whenever controller devices are added I check if it is an index controller and if so I setup a mask on the inputactionsasset to only use the Index control scheme.

    Might be a better way but I could not find one.
     
    Der_Heavynator and trnq1ll0 like this.
  7. Der_Heavynator

    Der_Heavynator

    Joined:
    Jun 13, 2022
    Posts:
    8
    I have been looking at this all day and it seems like the standard OpenXR mapping in SteamVR itself is simply bad.
    In SteamVR you have 3 values for the grip:
    • grip (a value between 0-1 that shows how much you "gripped" your controller)
    • gripPressed (a boolean thats shows if a certain threshold of the grip value is exceed)
    • gripForce (a value between 0-1 that shows how much force is applied to the grip surface)
    Grip and gripPressed seem to be the standard for the XR Interaction Toolkit, while gripForce seems to the exclusive to the Index Controller. Problem is that interactions (like grabbing) are using the gripPressed bool, which in SteamVR depends on the grip value, which does not represent how hard you grab your controller, but simply how much of your hand covers the grip sensor array.

    The solution would be to change the SteamVR mapping and have gripPressed be determined by the the gripForce.