[OpenXR] Invert the logic of detecting hand tracking detection #769
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So far the current code was checking whether hand tracking was active, and if that's
the case, then hand tracking was used as input. Otherwise we fell back to using controllers.
That approach has been working fine so far because the devices we ported Wolvic to,
do activate hand tracking only when the controllers are not used. However there are
some other systems that do continuosly track the hands (even when using the controllers,
as the MagicLeap2). For the latter ones, the above approach does not work because hand
tracking will be always active even when the controllers are being used.
That's why we should invert the check condition. From now on, we first check if the
controller pose is valid (by looking for its orientation valid bit (it does not make sense
to check for position because there are 3DoF controllers as well). If it's valid then we
use the controller. Otherwise we check whether hand tracking is enabled.
There is one exception, Pico runtime does continuously track the controllers even when
hand tracking is used. That's why for the case of Pico we always have to check whether
hand tracking is active.