MicrosoftDocs / mixed-reality

Mixed Reality documentation
Creative Commons Attribution 4.0 International
175 stars 184 forks source link

CreateCoordinateSystemForNode Value Range Error #575

Open rowanfr opened 2 years ago

rowanfr commented 2 years ago

I'm currently trying to use the "CreateCoordinateSystemForNode" function in the Unity editor using holographic remoting and not the UWP. I'm using code that is modified from the QRTracking/SampleQRCodes repository found here "https://github.com/chgatla-microsoft/QRTracking/tree/master/SampleQRCodes/Assets/Scripts".

The function line that is causing me issues is: CoordinateSystem = Microsoft.Windows.Perception.Spatial.Preview.SpatialGraphInteropPreview.CreateCoordinateSystemForNode(id);

I know the GUID is acceptable because I'm able to log it and an example of one of its values is: 211c716b-0c1b-4b67-9f1c-df4c70e1ef84

This should be an acceptable GUID to put into this function but it results in: ArgumentException: Value does not fall within the expected range. System.Runtime.InteropServices.Marshal.ThrowExceptionForHR (System.Int32 errorCode) (at <695d1cc93cca45069c528c15c9fdd749>:0) Microsoft.Windows.Perception.Spatial.Preview.ISpatialGraphInteropPreviewStatics.CreateLocatorForNode (System.Guid nodeId) (at <3b1a902236234f0d9695ca01952f5572>:0) Microsoft.Windows.Perception.Spatial.Preview.SpatialGraphInteropPreview.CreateLocatorForNode (System.Guid nodeId) (at <3b1a902236234f0d9695ca01952f5572>:0) QRTracking.SpatialGraphCoordinateSystem.UpdateLocation () (at Assets/QRTracking/Scripts/SpatialGraphCoordinateSystem.cs:155) QRTracking.SpatialGraphCoordinateSystem.Update () (at Assets/QRTracking/Scripts/SpatialGraphCoordinateSystem.cs:230)

Is this a function that only works within UWP or is my coding flawed in some sense? Is their anything I can do to resolve this issue?

The full modified code is found attached here: SpatialGraphCoordinateSystem.txt

The setup within unity is identical to the setup found within the tutorial here "https://codeholo.com/2021/03/27/qrcode-tracking-with-hololens-2-xr-sdk-and-mrtk-v2-5/" except for holographic remoting being enabled.

Thank you for your time.