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.
World Anchor Sharing - Unity
Hi,
I am trying to follow this guide in order to get my own network code for world anchor sharing in Unity.
https://developer.microsoft.com/en-us/windows/holographic/shared_holographic_experiences_in_unity
I currently have some working codes that can send the data from one hololens to the other. However, the call to
WorldAnchorTransferBatch.ExportAsync(transferBatch, OnExportDataAvailable, OnExportComplete);
generates eight instances of OnExportDataAvailable with bytes array of different sizes (from 4 bytes to more than 400kB). I tried to use each array independantly with
WorldAnchorTransferBatch.ImportAsync(importedData, OnImportComplete);
But the object that is related to the world anchor is not changing position, or at least does not seem to become closer to the position seen from the Hololens sending the anchor.
The unity documentation does not bring much light on this issue
https://docs.unity3d.com/550/Documentation/Manual/windowsholographic-anchorsharing.html
https://docs.unity3d.com/550/Documentation/ScriptReference/VR.WSA.Sharing.WorldAnchorTransferBatch.html
Does anybody have experience with those functions and can help me make sense of the output/input of WorldAnchorTransferBatch?
Thanks
unred.org
Best Answer
-
stepan_stulov ✭✭✭
From Unity documentation:
"The data from an export may be provided in chunks. Each chunk is ordered and must be in the correct order when restored."
I suppose that mean you need to concatenate all the byte arrays up until SerializationComplete is fired and then use the whole thing. I'm on the same task. Will write if it works.
UPDATE:
So it appears to be true. You need to be listening to multiple SerializationDataAvailable events and accumulate all the bytes arriving in separate array into one big array. You need to do this up until SerializationComplete event is fired. Then the resulting array is the complete byte blob that can be written, read and re-used into a new batch by calling the ImportAsync method. Fun fact is some partial byte arrays arrive in megabytes size and some in mere bytes.Building the future of holographic navigation. We're hiring.
7
Answers
From Unity documentation:
"The data from an export may be provided in chunks. Each chunk is ordered and must be in the correct order when restored."
https://docs.unity3d.com/ScriptReference/VR.WSA.Sharing.WorldAnchorTransferBatch.SerializationDataAvailableDelegate.html
I suppose that mean you need to concatenate all the byte arrays up until SerializationComplete is fired and then use the whole thing. I'm on the same task. Will write if it works.
UPDATE:
So it appears to be true. You need to be listening to multiple SerializationDataAvailable events and accumulate all the bytes arriving in separate array into one big array. You need to do this up until SerializationComplete event is fired. Then the resulting array is the complete byte blob that can be written, read and re-used into a new batch by calling the ImportAsync method. Fun fact is some partial byte arrays arrive in megabytes size and some in mere bytes.
Building the future of holographic navigation. We're hiring.