quemeful quemeful - 2 months ago 32
Swift Question

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

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
// 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()
Comments