Change origin of node in SceneKit Interface Builder -


does know how change origin of node in scenekit interface builder? origin incorrect, moving moves model, want move origin it's in middle of object :-/

maybe need re-export model different origin?

object origin

reposition node's pivot. example,

    trucknode.pivot = scnmatrix4maketranslation(13.4, 12.9, 28.9) 

you can change rotation of pivot appears interested in translational aspects above example satisfies.

another option make node child of otherwise empty "container node". reposition node within container , subsequent translations , rotations on container node.

another option using interface builder. select dae file. @ bottom of editor window, on left, square button bar on left. click open scene graph. show hierarchical list of nodes in file. in utilities panel right in xcode window, select "box" icon. can adjust nodes position numerically there. can drag axes directly in editor. not change pivot think want do. may have create new node act container mentioned above. can done right-clicking on node in scene graph bring menu. in opinion, setting pivot in code easier. details below.

btw, can names of nodes in dae scene scene graph in editor. here's how access dae nodes in code:

    guard let thetruck = scnscene(named: "mytruck") else {         print("couldn't find molecule in dictionary  (mytruck)")         return  }      let truck = thetruck.rootnode.childnodewithname("truckbase", recursively: true)!     truck.pivot = scnmatrix4maketranslation(12.0, 0, 8.0) 

in example: "mytruck" name of dae file without dae suffix. "truckbase" name of root node within dae file (you can change name in editor scene graph if desired). "truck" new node you've assigned root node of file. manipulate would, , instead of, root node of dae. "thetruck" temporary holder dae scnscene, used access nodes within. can access other nodes in dae same way allowing manipulate them in code.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -