Subclassing SCNScene and SceneKit Editor

前端 未结 3 1198
无人共我
无人共我 2021-01-28 02:18

I have SCNScene subclass with a camera setup, that I want to use in all the subclasses.

let scene01 = TheSubclassScene()
let scene02 = TheSubclassScene(named:\"a         


        
3条回答
  •  遥遥无期
    2021-01-28 02:41

    I have a workaround for that problem. Not nice but it works. I instantiate a SCNScene(named: "art.scnassets/testScene.scn") then I instantiate a TheSubclassScene() and I clone the rootNode of the scene and add it as a child node to the subclass scene.

    let testScene = SCNScene(named:"art.scnassets/testScene.scn")!
    let subclassScene = TheSubclassScene()
    subclassScene.rootNode.addChildNode(testScene.rootNode.clone())
    

提交回复
热议问题