The Mixed Reality Forums here are no longer being used or maintained.
There are a few other places we would like to direct you to for support, both from Microsoft and from the community.
The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.
For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.
If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.
And always feel free to hit us up on Twitter @MxdRealityDev.
Sharing Holograms Spatial Anchor
I keep having the same problem sharing holograms between 2 Hololenses. The holograms come out rotated and shifted on the Hololens the spatial anchor is sent to. I tried the Hologram 240 example and even in that one the Hologram comes out shifted and rotated in the shared Hololens. I tried deleting the spaces in both Hololenses and rescanning the room and in 3d view from device portal, the rooms look identical. I tried switching which hololens sends the anchor and which receives and still get noticeably shifted placement of holograms. Is there some sort of calibration the Hololenses need?
Best Answer
-
dbarrett ✭✭✭
When you display holograms over UNET you have to make their positions relative to the shared anchor. Otherwise they will be rotated and offset based off of where you started up the app.
Each HoloLens uses its own set of Unity coordinates. So, 0,0,0 is in two different physical locations for each HoloLens. The anchor is used as a shared point and each HoloLens knows at what position that anchor is in.
For example, if HoloLens1 has the anchor at 0,0,0 and HoloLens2 has the anchor at 0,0,1 then, Hololens1 wants to put a Hologram at 1,0,0. According to HoloLens2 that object is really at 1,0,-1. In order to combat this whenever you set a position you need to get the position relative to the Anchor. You can do this as following:
object.transform.position = AnchorTransform.InverseTransformPoint(ObjectPositionToShare);
Unfortunately, that is not entirely your problem because, you have to send this over the network and tell the server where this position is and then have it displayed to the clients that are connected.
I solved this issue here:
https://forums.hololens.com/discussion/8574/sharing-with-unet-client-hololens-rotation-is-off#latestHowever, if you are using the latest release of Unity I'd recommend the updated script from the MRTK here:
https://github.com/Microsoft/MixedRealityToolkit-Unity/blob/master/Assets/HoloToolkit/SharingWithUNET/Scripts/UNetSharedHologram.csAR Developer
5
Answers
When you display holograms over UNET you have to make their positions relative to the shared anchor. Otherwise they will be rotated and offset based off of where you started up the app.
Each HoloLens uses its own set of Unity coordinates. So, 0,0,0 is in two different physical locations for each HoloLens. The anchor is used as a shared point and each HoloLens knows at what position that anchor is in.
For example, if HoloLens1 has the anchor at 0,0,0 and HoloLens2 has the anchor at 0,0,1 then, Hololens1 wants to put a Hologram at 1,0,0. According to HoloLens2 that object is really at 1,0,-1. In order to combat this whenever you set a position you need to get the position relative to the Anchor. You can do this as following:
object.transform.position = AnchorTransform.InverseTransformPoint(ObjectPositionToShare);
Unfortunately, that is not entirely your problem because, you have to send this over the network and tell the server where this position is and then have it displayed to the clients that are connected.
I solved this issue here:
https://forums.hololens.com/discussion/8574/sharing-with-unet-client-hololens-rotation-is-off#latest
However, if you are using the latest release of Unity I'd recommend the updated script from the MRTK here:
https://github.com/Microsoft/MixedRealityToolkit-Unity/blob/master/Assets/HoloToolkit/SharingWithUNET/Scripts/UNetSharedHologram.cs
AR Developer
dbarret, THANK YOU! It works beautifully now.