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
359 stars 91 forks source link

[BUG] InteractionModeManager mode detection stays on obsolete mode #803

Open jlundycom opened 1 month ago

jlundycom commented 1 month ago

Describe the bug

When implementing a custom interactor that stays continuously active (teleport mode), I found that when the NearInteractor was detected it would switch to the NearInteractor (higher priority) and would stay on the near interactor even when not active.

To reproduce

Steps to reproduce the behavior:

  1. Create a new interactor with a detector that is always on, set it to a lower priority than near interactor.
  2. Activate the new interactor.
  3. Do a near mode interaction (while the other interactor is still valid)
  4. Stop doing the near mode interaction
  5. The near interaction mode stays active even though it is not currently being detected.

Expected behavior

When the lower priority interaction modes are no longer valid it should switch off them.

Your setup (please complete the following information)

Target platform (please complete the following information)

Additional context

Modifying the InteractionModeManager update loop and SetInteractionMode so that the firsst time a detector triggers it sets the interaction mode for the controllers fixes the problem. The previous code would only reset the default mode if no detectors triggered. If a detector triggers during the update loop it will not switch to a lower priority interactor even if the current mode is higher priority, even if no detector for the existing higher mode is triggered.

shaynie commented 1 month ago

@jlundycom We're focusing on the XRI 3 updates. If you have a suggested fix, please submit a PR.