Igalia / wolvic

A fast and secure browser for standalone virtual-reality and augmented-reality headsets.
https://wolvic.org
Mozilla Public License 2.0
796 stars 100 forks source link

[OpenXR] Discard unsolicited hand gestures with hand interaction profile #1467

Closed svillar closed 2 months ago

svillar commented 2 months ago

We use the gesture of facing the hand palm plus a pinch to perform some actions. With the left hand that's mapped to a back action, while with the right hand that means exit the application.

When using the hand interaction profile (only in MagicLeap2 so far), we were sometimes getting those gestures just by moving the hands out of sight. That was triggering a lot of unsolicited actions that confuse users.

There were two main causes for that erroneous behaviour:

  1. we were asuming that if aim was not valid then it was because the hand was facing the head. That's correct but the aim is also not valid if the hand is untracked (mostly when out of sight).
  2. the OpenXR runtime has a bug, and sometimes returns 1.0 (or in general values close to 1.0) in the pinch_ext action (meaning that there is a pinch) when the hand is completely opened but moving from tracked to untracked state.

This PR fixes both issues making the code far more robust.