SCNSceneSource identifiers with usdz file are empty

560 Views Asked by At

We are working on a project with ARKit 2 + SceneKit, iOS 12. We were able to retrieve CAAnimation instances with .dae files and control them at runtime. Now, we are trying .usdz, but none of the classes can be extracted from SCNSceneSource with usdz :

let source = SCNSceneSource(url: url, options: options)
let animationIdentifiers = source?.identifiersOfEntries(withClass: CAAnimation.self)

animationIdentifiers is always empty. The same goes for all classes listed in the documentation for this function https://developer.apple.com/documentation/scenekit/scnscenesource/1523656-identifiersofentries

We have tested our own usdz creations as well as some usdz from https://fusionar.app.

Tough, the animations play nicely when viewing the file either on iOS or in Xcode, where we have access to the animations and scene graph settings :

Xcode animation

But definitely not from code at runtime, so we are unable to control the animations.

Have you ever had this issue ?

Any insight on this ?

1

There are 1 best solutions below

1
On BEST ANSWER

Retrieving entries from a SCNSceneSource only works for Collada files. When working with USDZ file you'll have to traverse the node hierarchy and retrieve the animation from the node that holds it using -animationPlayerForKey:.