Search code examples
swiftaugmented-realityios11arkitmultiplayer

ARKit with multiple users


What is the best way, if any, to use Apple's new ARKit with multiple users/devices?

It seems that each devices gets its own scene understanding individually. My best guess so far is to use raw features points positions and try to match them across devices to glue together the different points of views since ARKit doesn't offer any absolute referential reference.

===Edit1, Things I've tried===

1) Feature points

I've played around and with the exposed raw features points and I'm now convinced that in their current state they are a dead end:

  • they are not raw feature points, they only expose positions but none of the attributes typically found in tracked feature points
  • their instantiation doesn't carry over from frame to frame, nor are the positions exactly the same
  • it often happens that reported feature points change by a lot when the camera input is almost not changing, with either a lot appearing or disappearing.

So overall I think it's unreasonable to try to use them in some meaningful way, not being able to make any kind of good point matching within one device, let alone several. Alternative would to implement my own feature point detection and matching, but that'd be more replacing ARKit than leveraging it.

2) QR code

As @Rickster suggested, I've also tried identifying an easily identifiable object like a QR code and getting the relative referential change from that fixed point (see this question) It's a bit difficult and implied me using some openCV to estimate camera pose. But more importantly very limiting


Solution

  • Now, after releasing ARKit 2.0 at WWDC 2018, it's possible to make games for 2....6 users.

    For this, you need to use ARWorldMap class. By saving world maps and using them to start new sessions, your iOS application can now add new Augmented Reality capabilities: multiuser and persistent AR experiences.

    AR Multiuser experiences. Now you may create a shared frame of a reference by sending archived ARWorldMap objects to a nearby iPhone or iPad. With several devices simultaneously tracking the same world map, you may build an experience where all users (up to 6) can share and see the same virtual 3D content (use Pixar's USDZ file format for 3D in Xcode 10+ and iOS 12+).

    session.getCurrentWorldMap { worldMap, error in 
        guard let worldMap = worldMap else {
            showAlert(error)
            return
        }
    }
    
    let configuration = ARWorldTrackingConfiguration()
    configuration.initialWorldMap = worldMap
    session.run(configuration)
    

    AR Persistent experiences. If you save a world map and then your iOS application becomes inactive, you can easily restore it in the next launch of app and in the same physical environment. You can use ARAnchors from the resumed world map to place the same virtual 3D content (in USDZ or DAE format) at the same positions from the previous saved session.