Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

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.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. 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. 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.