chgatla-microsoft / QRTracking

MRTK sample app for QRtracking
MIT License
74 stars 69 forks source link

Unity editor support #23

Closed Zulex closed 3 years ago

Zulex commented 3 years ago

Hi all,

Currently I'm trying to make the QR tracker work in Unity editor to allow easy debugging and fast iteration. I've already found I should be using Microsoft.Windows.Perception.Spatial to allow holographic remoting. But the QR doesn't get updated in the coe made for (windows_uwp).

I'm converting this to editor compatible code. These two lines in SpatialGraphCoordinateSystem.cs seem to not convert well to unity compatible code:

System.IntPtr rootCoordnateSystemPtr = UnityEngine.XR.WindowsMR.WindowsMREnvironment.OriginSpatialCoordinateSystem;
SpatialCoordinateSystem rootSpatialCoordinateSystem = (SpatialCoordinateSystem)System.Runtime.InteropServices.Marshal.GetObjectForIUnknown(rootCoordnateSystemPtr);

Trying to convert to native unity objects does gives me only null references. Anyone managed to solve this to allow in editor marker tracking via the new XR remoting system?

Hope the info given is sufficient. If not, please let me know.

Zulex commented 3 years ago

Found a fix.

idea-lei commented 3 years ago

could you pls share how did you manage it? thx a lot

studentutu commented 3 years ago

@Zulex please provide a fix - you can create fork from this repo and make a fix in it