MixedRealityToolkit / MixedRealityToolkit-Unity

This repository holds the third generation of the Mixed Reality Toolkit for Unity. The latest version of the MRTK can be found here.
BSD 3-Clause "New" or "Revised" License
375 stars 96 forks source link

[XRI3] [BUG] PinchInputReader can get stuck using polyfill pinch detection #885

Closed whebertML closed 2 weeks ago

whebertML commented 1 month ago

Describe the bug

PinchInputReader can get stuck using polyfill pinch detection, even when the user has switched from hands to controller that has an input profile that has bound controls on the input actions.

To reproduce

Steps to reproduce the behavior:

  1. Configure the MRTK3, version 4.0.0-pre.1, project to build for Quest, and build+deploy the app to a Meta Quest 2 or 3.
  2. While using hands (not controller), start the app, and continue using only hands when the app comes up.
  3. Confirm pinch selection using hands, which on the Quest 2/3 should be utilizing polyfill.
  4. Switch to using the Quest Controller, and notice pinch selection with the controller trigger does not work.
  5. Note: If the app is started using the controller, pinch selection works with the controller, and the user can switch between hands and controller. It is only if the app is started with hands where the issue arises.

This is due to the logic to cache the input action validity for the select & select values upon startup getting locked to false when using hands, and these flags never get re-evaluated when switching input from hands to controller. When they are false, the logic always goes to polyfill. When they are true, as when starting the app with the controller, the logic ends up switching between polyfill and the input actions based on GetIsPolyfillDevicePose(). See code below:

            if (!m_isSelectionActionValidCache || !m_isSelectionActionValueValidCache || GetIsPolyfillDevicePose())
            {
                UpdatePinchSelection();
            }

Should we only rely on GetIsPolyfillDevicePose(), or perhaps call UpdateActionValidCaches() every frame instead of only first frame?

Expected behavior

Pinch selection works on the Quest Controller after having switched from hands to controller.

Your setup (please complete the following information)

Target platform (please complete the following information)

whebertML commented 1 month ago

@AMollis FYI ^ Discovered the issue I was seeing on Quest with the controller and pinch select.

AMollis commented 2 weeks ago

Fixed this #892