How do you load a .dae file into an SCNNode in iOS SceneKit?

The usual pattern is to load your scene and retrieve the node you are interested in with its name using

[scene.rootNode childNodeWithName:aName recursively:YES];

Then you can reparent this node to your main scene.


I had a similar problem where I had one .dae file and I wanted to load multiple nodes from that file into a node. This worked for me:

var node = SCNNode()
let scene = SCNScene(named: "helloScene.dae")
var nodeArray = scene.rootNode.childNodes

for childNode in nodeArray {
  node.addChildNode(childNode as SCNNode)
}

First, I set a node that will hold it all together so it looks like it does in the original file. Next we import the .dae file we want and copy all the nodes inside of it. Lastly, for each node in the array I added it to the node.