Hello everyone.

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.

Different coordinate systems

I'm trying to use network transforms to synchronize moving objects. But a network transform sends position/movement information relative to the current device's coordinate system (in which the origin is located at the position of the HoloLens I think?). Another HoloLens has a different coordinate system and so the synchronization doesn't work.

It sounds like Spatial Anchors are what I should be using, but I can't figure out how Network Transforms and Spatial Anchors can work together.

Tagged:

Answers

  • stepan_stulovstepan_stulov ✭✭✭
    edited April 2018

    Hey, @myieye

    I'm not completely familiar with NetworkTransform, but a quick googling revealed this:

    https://docs.unity3d.com/Manual/class-NetworkTransformChild.html

    You need to make sure you don't have NetworkTransform and world anchors conflicting, since these are two different systems working on the same component (Transform). Have a look at these threads:

    https://forums.hololens.com/discussion/comment/20825
    https://forums.hololens.com/discussion/comment/15033

    Cheers

    Building the future of holographic navigation. We're hiring.

  • dbarrettdbarrett ✭✭✭

    This is a very common problem some people have when working with multiplayer. There are a bunch of different ways for moving objects, some of which do not require Network Transforms. However, if you want to proceed this way, all you need to do is take your sharedAnchorTransform and set the position of your object to the InverseTransformPoint of that sharedAnchorTransform. It should look something like this:

    [SyncVar] Vector3 localPosition;

    localPosition = sharedAnchorTransform.InverseTransformPoint(objPosition);

    then right after you would update the position on the server with a method like below:

    [Command]
    CmdTransform(Vector3 position) { if(!isLocalPlayer) localPosition = position; }

    You would only set localPosition if you have Authority over that object, otherwise you would just get that variable.

    AR Developer

Sign In or Register to comment.