Search code examples
swiftaugmented-realityarkitrealitykitreality-composer

Reality Composer and dealing with multiple surfaces


I want to know if there is a way for the scenes that gets exported from the reality composer to deal with multiple surfaces in the real world.

So for example, if we create a scene with a ball that applies a force on the x axis when we touch the ball. I would expect when the scene added on top of a table if the ball gets out of bounds of the table the ball should fall. Which is not happening, the scene is working on one surface only.

Am I missing something or Reality Composer does not support complex scenarios ?

Thanks


Solution

  • In Reality Composer a grid simultaneously performs two important roles:

    • a hidden infinite collision plane
    • an infinite shadows' catcher

    If you want any complex dynamics to occur – alas, at the moment it's possible only above the grid and on the grid (in case you haven't turned the grid off). Hence, in that sense, now Reality Composer doesn't support complex collision scenarios.

    But as a consolation prize, you can load multiple scenes from .rcproject:

    @IBAction func pressButton(_ sender: UIButton) {
    
        if counter % 2 == 0 {
            let sceneElements_04 = try! myScenes.loadScene_04()
            arView.scene.anchors.append(sceneElements_04)
        } else if counter >= 10 {
            let sceneElements_25 = try! myScenes.loadScene_25()
            arView.scene.anchors.append(sceneElements_25)
        } else {
            let sceneElements_12 = try! myScenes.loadScene_12()
            arView.scene.anchors.append(sceneElements_12)
    }