Home > front end >  How to find a QR Code position using unity and HoloLens
How to find a QR Code position using unity and HoloLens

Time:10-11

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?

CodePudding user response:

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).

CodePudding user response:

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;
            }
        }
  • Related