swift - SceneKit - how to get animations for a .dae model? -


ok, working arkit , scene kit here , having trouble looking @ other questions dealing scene kit trying have model in .dae format , load in various animations have model run - we're in ios11 seems solutions don't work.

here how model - base .dae scene no animations applied. importing these maya -

var modelscene = scnscene(named: "art.scnassets/ryderfinal3.dae")!      if let d = modelscene.rootnode.childnodes.first {         thedude.node = d         thedude.setupnode()     } 

then in dude class:

func setupnode() {     node.scale = scnvector3(x: modifier, y: modifier, z: modifier)     center(node: node) } 

the scaling , centering of axes needing because model not @ origin. worked. different scene called "idle.dae" try load in animation later run on model:

func animationfromscenenamed(path: string) -> caanimation? {     let scene  = scnscene(named: path)     var animation:caanimation?     scene?.rootnode.enumeratechildnodes({ child, stop in         if let animkey = child.animationkeys.first {             animation = child.animation(forkey: animkey)             stop.pointee = true         }     })     return animation } 

i going animations scenes import xcode , store animations in

var animations = [caanimation]() 

first xcode says animation(forkey: deprecated , not work seems (from can tell) de-center , de-scale model huge size was. screws position because expect making model move in animation, example, make instantiated model in game snap same position.

and other attempts cause crashes. new scene kit , trying grip on how animate .dae model instantiate anywhere in scene -

  1. how in ios11 1 load in array of animations apply scnnode?

  2. how make animations run on model wherever model (not snapping other position)?


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -