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

前端 未结 6 1251
你的背包
你的背包 2021-01-31 10:14

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

6条回答
  •  甜味超标
    2021-01-31 10:46

    Thanks for your help!

    Here is a simple collada2Node class.

    //collada2SCNNode
    class func collada2SCNNode(filepath:String) -> SCNNode {
        var node = SCNNode()
        let scene = SCNScene(named: filepath)
        var nodeArray = scene!.rootNode.childNodes
    
        for childNode in nodeArray {
            node.addChildNode(childNode as SCNNode)
        }
        return node
    }
    

提交回复
热议问题