I want to show two different 3D objects in two different ARSCNViews. With this question it's allowed to show the two ARSCNViews, but it is basically cloned one view to another.
I want to display different objects in each view.
Do you have any idea?
I want to show two different 3D objects in two different ARSCNViews. With this question it's allowed to show the two ARSCNViews, but it is basically cloned one view to another.
I want to display different objects in each view.
Do you have any idea?
Yes, it's possible. You can create two ARSCNViews with different models, or even a RealityKit view and an ARKit view. However, in both cases you have to use the same running ARSession. It is not possible to run two different sessions in parallel.
import ARKit
class ViewController: UIViewController {
@IBOutlet var sceneView: ARSCNView!
@IBOutlet var sceneViewTwo: ARSCNView!
override func viewDidLoad() {
super.viewDidLoad()
sceneViewTwo.session = sceneView.session
let scene = SCNScene(named: "art.scnassets/ship.scn")!
sceneView.scene = scene
let sceneTwo = SCNScene()
sceneViewTwo.scene = sceneTwo
let sphere = SCNNode(geometry: SCNSphere(radius: 0.1))
sphere.position.z = -1.0
sceneViewTwo.scene.rootNode.addChildNode(sphere)
let config = ARWorldTrackingConfiguration()
sceneView.session.run(config)
}
}