microsoft / MixedReality-QRCode-Sample

A single repository of Mixed Reality samples in Unity.
MIT License
101 stars 30 forks source link

Diff between OpenXR QR sample vs. WinRT QR sample in Unity #18

Open yl-msft opened 2 years ago

yl-msft commented 2 years ago

Please don't merge this PR into main branch.

This PR is to highlight an OpenXR unity project vs. the WinRT unity project for QR tracking. Other than adding the OpenXR plugin package to the unity package manifest and auto generated openxr settings, the key difference is in the SpatialGraphNodeTracker.cs file, where the SpatialGraphNode class is built in the OpenXR plugin to provide tracking of a static node represented by GUID from the platform.

Note: you can checkout the OpenXR QR code sample from the "openxr" branch:

https://github.com/microsoft/MixedReality-QRCode-Sample/tree/OpenXR

maaron commented 2 years ago

This approach works for me, but there is a problem that occurs if the HoloLens loses tracking and starts mapping a new space that is unrelated to the space the app started with. By "unrelated", I mean that the new space is not connected to the old one. In this case, the TryLocate method returns false. This can be easily reproduced by deleting the spatial maps using the device portal:

  1. Start the app
  2. Note that QR tracking works as expected
  3. In Device Portal / System / Map Manager, press "Reset system map, anchors and spatial mapping database"
  4. Wait for the HL to regain tracking
  5. Try scanning the QR code again, and notice that the QR code can be detected, but the pose of the marker cannot be obtained.