Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Oculus Left Controller, no continuous value with Player Input (right is working fine)

Discussion in 'Input System' started by STEMax, Jan 4, 2021.

  1. STEMax

    STEMax

    Joined:
    Jun 18, 2018
    Posts:
    13
    Hi Guys,

    I'm facing a strange behavior with the Input System and Oculus Touch controller. I'm trying to use the button on the controllers (A/B, X/Y) to simulate continuous value, that is when I press the button and don't release it the action is called every frame or so and run my code.

    Currently this is working fine with the right controller (button A/B), on the left controller however the action is triggered only once, despite using the same Action Type and Binding Type than on right one. Thus I need to press the button again and again to get my code run once at a time.

    To give you moe context, the button on the right controller are for Zoom In / Zoom Out and this is working fine, whereas the button on the left controller are for Rotate Left, Rotate Right and those are not working as expected. If I inverse the code in my action callback then the rotation is working as expected, so the issue does not come from the code but from the binding however I can't understand why (as I used the exact same configuration and verified it in the JSON on the inputactions).

    For the sake of completness : I'm using Player Input component with Send Message behavior on a Oculus Quest 2 with link (so acting like a Rift).

    Is there any limitation on the left controller?

    Below is the InputActions code I use

    Thanks for any help,
    STEMax

    Code (JavaScript):
    1. {
    2.     "name": "MainInput",
    3.     "maps": [
    4.         {
    5.             "name": "MapControls",
    6.             "id": "6a496369-fc99-4763-9d73-1c6f5c4a368e",
    7.             "actions": [
    8.                 {
    9.                     "name": "Move",
    10.                     "type": "Value",
    11.                     "id": "5666561e-037f-4841-86b2-c51c5d8c9035",
    12.                     "expectedControlType": "Vector2",
    13.                     "processors": "",
    14.                     "interactions": ""
    15.                 },
    16.                 {
    17.                     "name": "ZoomIn",
    18.                     "type": "Value",
    19.                     "id": "89438bf3-70bc-4fb3-9213-ef6e148d193d",
    20.                     "expectedControlType": "Button",
    21.                     "processors": "",
    22.                     "interactions": ""
    23.                 },
    24.                 {
    25.                     "name": "ZoomOut",
    26.                     "type": "Value",
    27.                     "id": "9c894bf7-aac7-4db0-8793-f926d844e15e",
    28.                     "expectedControlType": "Button",
    29.                     "processors": "",
    30.                     "interactions": ""
    31.                 },
    32.                 {
    33.                     "name": "RotateLeft",
    34.                     "type": "Value",
    35.                     "id": "b60cae69-54fa-4ddc-b8eb-4ccfc947b615",
    36.                     "expectedControlType": "Button",
    37.                     "processors": "",
    38.                     "interactions": ""
    39.                 },
    40.                 {
    41.                     "name": "RotateRight",
    42.                     "type": "Value",
    43.                     "id": "23ecf81c-c6a6-43e1-8e28-68fa50060629",
    44.                     "expectedControlType": "Button",
    45.                     "processors": "",
    46.                     "interactions": ""
    47.                 }
    48.             ],
    49.             "bindings": [
    50.                 {
    51.                     "name": "",
    52.                     "id": "3d358ebc-cfed-4fd3-8d23-e70db8ddcbb1",
    53.                     "path": "<OculusTouchController>{LeftHand}/thumbstick",
    54.                     "interactions": "",
    55.                     "processors": "",
    56.                     "groups": "XR",
    57.                     "action": "Move",
    58.                     "isComposite": false,
    59.                     "isPartOfComposite": false
    60.                 },
    61.                 {
    62.                     "name": "",
    63.                     "id": "f019b6d2-c839-49ef-b95a-d76894334f2b",
    64.                     "path": "<XRInputV1::Oculus::OculusTouchControllerRight>{RightHand}/secondarybutton",
    65.                     "interactions": "",
    66.                     "processors": "",
    67.                     "groups": "XR",
    68.                     "action": "ZoomIn",
    69.                     "isComposite": false,
    70.                     "isPartOfComposite": false
    71.                 },
    72.                 {
    73.                     "name": "",
    74.                     "id": "7896fc92-21f4-49e1-a1a0-95a8d20097ce",
    75.                     "path": "<XRInputV1::Oculus::OculusTouchControllerRight>{RightHand}/primarybutton",
    76.                     "interactions": "",
    77.                     "processors": "",
    78.                     "groups": "XR",
    79.                     "action": "ZoomOut",
    80.                     "isComposite": false,
    81.                     "isPartOfComposite": false
    82.                 },
    83.                 {
    84.                     "name": "",
    85.                     "id": "a83fe9cf-a9af-43e7-8501-f65d0acb248f",
    86.                     "path": "<XRInputV1::Oculus::OculusTouchControllerLeft>{LeftHand}/primarybutton",
    87.                     "interactions": "",
    88.                     "processors": "",
    89.                     "groups": "XR",
    90.                     "action": "RotateLeft",
    91.                     "isComposite": false,
    92.                     "isPartOfComposite": false
    93.                 },
    94.                 {
    95.                     "name": "",
    96.                     "id": "00d9816a-2a9e-416e-939b-8d4bd745f072",
    97.                     "path": "<XRInputV1::Oculus::OculusTouchControllerLeft>{LeftHand}/secondarybutton",
    98.                     "interactions": "",
    99.                     "processors": "",
    100.                     "groups": "XR",
    101.                     "action": "RotateRight",
    102.                     "isComposite": false,
    103.                     "isPartOfComposite": false
    104.                 }
    105.             ]
    106.         }
    107.     ],
    108.     "controlSchemes": [
    109.         {
    110.             "name": "XR",
    111.             "bindingGroup": "XR",
    112.             "devices": [
    113.                 {
    114.                     "devicePath": "<XRController>",
    115.                     "isOptional": false,
    116.                     "isOR": false
    117.                 }
    118.             ]
    119.         }
    120.     ]
    121. }
     
  2. STEMax

    STEMax

    Joined:
    Jun 18, 2018
    Posts:
    13
    Hi Guys,

    I keep on searching on this issue, currently I tried using a composite binding with 1D axis and the issue is same, next step : get rid of the Player Input and try to script the actions myself, I'll keep you informed.
     
  3. STEMax

    STEMax

    Joined:
    Jun 18, 2018
    Posts:
    13
    Hi Guys,

    I finally managed to get this working : I ended up generating the class from the input actions and polling the status of the action in my component script. That is MyActionMap.MyAction.ReadValue<float>() in the Update() function of my script. It works fine. I might optimize it a bit by only checking the value if the action has triggered the callback but currently I did not even test what would be faster / less cpu intensive, so that will be for a next session.

    More info here: https://docs.unity3d.com/Packages/c...1.0/manual/Actions.html#responding-to-actions (section Polling Actions)
     
    Last edited: Jan 5, 2021