I am having trouble understanding how geometry from .dae
files should be loaded into an iOS SceneKit scene graph.
I know that you can load .dae
The following answers didn't work for me.
Here is what worked for me in Xcode 7.0 beta 5 , iOS 9.0 beta / Swift 2.0:
3D model type: Collada 3D model name: "model.dae"
Load the scene:
let lampScene = SCNScene(named: "art.scnassets/model.dae")
Access the child SCNode which is in the SCNScene:
let lampRootNode = lampScene?.rootNode.childNodes[0]
Add the lamp node from the loaded scene into the current loaded and viewed scene:
self.scene.rootNode.addChildNode(lampRootNode!)
NOTE: The self.scene
exists due to:
private var scene:SCNScene!
Prior of adding the object to the scene I have made some scene setup according to the scene kit example. If you need the code mention it in the comments.
Hope it helps.