I am trying to create an application that will allow to place 3d objects. I was able to write some code that works, but only with geometric objects. I need to add multiple SCNScenes to one scene. How do I implement this?
How I have tried:
let sceneView = SCNView()
sceneView.scene = SCNScene()
sceneView.allowsCameraControl = true
sceneView.autoenablesDefaultLighting = true
sceneView.backgroundColor = .gray
let firstScene = SCNScene(named: "Earth.usdz")!
let firstSceneNode = firstScene.rootNode.childNode(withName: "Earth", recursively: true)!
firstSceneNode.rotate(by: .init(0, 0, 0, 0), aroundTarget: SCNVector3(0, -30, 10))
sceneView.scene?.rootNode.addChildNode(firstSceneNode)
let secondScene = SCNScene(named: "Venus.usdz")!
let secondSceneNode = secondScene.rootNode.childNode(withName: "Venus", recursively: true)!
sceneView.scene?.rootNode.addChildNode(secondSceneNode)
When I delete secondScene everything works with one model.
Thanks!
