Search Unity

ARKit 2 and MultiPeer Connectivity to share anchors

Discussion in 'ARKit' started by T1nk35B3ll, Sep 27, 2018.

  1. T1nk35B3ll

    T1nk35B3ll

    Joined:
    Aug 22, 2017
    Posts:
    2
    I'm trying to share an anchor between two devices.
    All the examples show that we can share the WorldMap, using the serialized format of the ARWorldMap, but I don't understand how I can get the anchors from the ARWorldMap to render these anchors on the other device.

    I use the MultiPeer Connectivity feature. I am able to share the ARWorldMap.
    Reading the Apple's documentation, the ARSession contains the anchors saved in the map. Each anchor should have a name property that we could use to determine which 3D model to display when we resume a session.
    Regarding the Unity plugin, I don't find a way to get those anchors.

    Can someone could enlighten me ?

    For the info : Unity 2018.2.7 + iPhone 7 and iPhone X both on iOS 12, MultiPeer Connectivity plugin from Prime 31
     
  2. MrMatthias

    MrMatthias

    Joined:
    Sep 18, 2012
    Posts:
    139
    this is currently not supported by the plugin. You could add that functionality to the plugin or share a dictionary consisting of anchor identifiers and descriptions when you share the map
     
  3. jimmya

    jimmya

    Unity Technologies

    Joined:
    Nov 15, 2016
    Posts:
    784
    I'm not sure this is true - ARWorldMap contains any user anchors too I believe. I haven't tried this myself, but if you add user anchors before you save the ARWorldMap, when you load ARWorldMap and it relocalizes, you should get your ARUserAnchorAdded callbacks for every user anchor that was saved.
     
  4. MrMatthias

    MrMatthias

    Joined:
    Sep 18, 2012
    Posts:
    139
    that's true but the anchors have a random identifier, so you can't tell what that anchor represents unless you save and synchronize that meta data
     
  5. jimmya

    jimmya

    Unity Technologies

    Joined:
    Nov 15, 2016
    Posts:
    784
    You are right dangit! User anchors have a name field that you can provide, but the plugin does not use the initWithName:transform method to create anchors. Feature request?
     
  6. jimmya

    jimmya

    Unity Technologies

    Joined:
    Nov 15, 2016
    Posts:
    784
  7. NAKAS

    NAKAS

    Joined:
    Jan 16, 2013
    Posts:
    19
  8. MrMatthias

    MrMatthias

    Joined:
    Sep 18, 2012
    Posts:
    139
    Would be great, or i make a pull reuest on the weekend
     
    fbenedetti and jimmya like this.