Reputation: 21
I'm new to HoloLens and Unity engine Ive been trying to find the QR Code position using the program https://github.com/yl-msft/QRTracking so that i can use it to anchor my holograms to it but I cant seem to be able to figure it out. Does anyone know a way I can do this?
Upvotes: 1
Views: 1594
Reputation: 11
I was running into a similar issue. I am using Unity 2021.3.
I was following the documentation here (https://learn.microsoft.com/en-us/windows/mixed-reality/develop/advanced-concepts/qr-code-tracking-overview) along with the github repo with the sample project.
What I needed to do was change the branch to the Open XR branch (https://github.com/microsoft/MixedReality-QRCode-Sample/tree/OpenXR#openxr-sample)
And when I copied the scripts and prefabs folder from the Open XR branch into my project and tested, it worked. The QR Code Prefab was following my irl QR code, when I scanned it with the HoloLens 2.
Upvotes: 1
Reputation: 21
I Was able to get it dont know if its the right way but it works. I had to add another script to the QRCode prefab cube then give the cube a tag name then reference its position using
GameObject[] spatial;
spatial = GameObject.FindGameObjectsWithTag("cube");
foreach (GameObject go in spatial)
{
// Get script
QRPosition qrPosition = go.GetComponent<QRPosition>();
//If found script
if (qrPosition != null)
{
position = qrPosition.positions;
}
}
Upvotes: 0
Reputation: 816
Normally, you need to give the application webcam permission and start QR Track in the code. Then the application will automatically track OR Code. You can Refer to QR Code tracking API reference to use QR Track feature in Unity/C# and use SpatialGraphNodeId to get the coordinate. Also, please refer to QR code tracking overview - Mixed Reality | Microsoft Learn for the best practices, and you can refer to this sample(https://github.com/microsoft/MixedReality-QRCode-Sample).
Upvotes: 1