ios - Copy geometry from one scene into another -


i'm playing around scenekit , swift (but answers in objective-c fine).

i know how load collada file scene. (can load node?)

this swift code i'm using:

    let url = nsbundle.mainbundle().urlforresource("weasel", withextension: "dae")     var error: nserrorpointer? = nil     let weasel = scnscene.scenewithurl(url, options: nil, error: error!) 

(i'm not sure how idiomatic way i've declared error is. feel free enlighten me.)

this seems work fine, want insert in scene (or whole scene, doesn't matter) scene. i've gotten compile , run, not appear work.

    let weaselnode = scnnode()     weaselnode.geometry = scnnode(geometry: weasel.rootnode.geometry)     scene.rootnode.addchildnode(weaselnode) 

here, retrieving root node's geometry (which nil). need node(s) interested in (not geometry) scene , add them scene b.

pseudo code should be:

scnnode *weaselnodetree = [scenea.rootnode childnodewithname:                              @"theobjectnameimlookingfor" recursively:yes]; 

(then optional if don't want modify scene a: weaselnodetree = [weaselnodetree clone];)

[sceneb.rootnode addchildnode:weaselnodetree]; 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -