load a collada (dae) file into SCNNode (Swift - SceneKit)

quemeful picture quemeful · Aug 19, 2014 · Viewed 15.4k times · Source

This works

let scene = SCNScene(named: "house.dae")

Is there an equivalent for a node?

let node = SCNNode(geometry: SCNGeometry( ..??.. "house.dae" ..??.. ))

I have searched high and low, finding nothing that will load an entire dae file into a SCNNode. (not just one ID from it)

Answer

user3957490 picture user3957490 · Aug 19, 2014
// add a SCNScene as childNode to another SCNScene (in this case to scene)
func addSceneToScene() {
    let geoScene = SCNScene(named: "art.scnassets/ball.dae")
    scene.rootNode.addChildNode(geoScene.rootNode.childNodeWithName("Ball", recursively: true))
}
addSceneToScene()