animation - SceneKit Swift3 compiler-error -


i'm trying run animated "dae" model in scenekit:

let url = bundle.main.url(forresource: "art.scnassets/player(walking)", withextension: "dae")     let scenesource = scnscenesource(url: url!, options: [scnscenesource.loadingoption.animationimportpolicy: scnscenesource.animationimportpolicy.playrepeatedly] )     let animationids: nsarray = scenesource?.identifiersofentries(withclass: caanimation)      eachid in animationids {         let animation: caanimation = (scenesource?.entrywithidentifier(eachid as! string, withclass: caanimation.self))!         animations.add(animation)     }     character?._walkanimations = animations 

but compiler throws on line:

let animationids: nsarray = scenesource?.identifiersofentries(withclass: caanimation)

and writes error:

cannot convert value of type '[string]?' specified type 'nsarray'

please me fix problem.

thanks in advance.

why converting [string]? nsarray , convert each element string again, no need of use swift native array , wrapped optional value if let or guard let.

guard let animationids = scenesource?.identifiersofentries(withclass: caanimation) else {     return } eachid in animationids {     if let animation = scenesource?.entrywithidentifier(eachid, withclass: caanimation.self) {         animations.add(animation)     } } character?._walkanimations = animations 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -