0
sceneView.scene = try SCNScene(url: url, options: [SCNSceneSource.LoadingOption.checkConsistency : true])
            sceneView.scene?.isPaused = true // pausing the default animation

I am loading the usdz model with the above code, model loads fine and one animation starts playing in loop even though i have not written any code for it, this model comes with total 3 animations I am not able to get those animations from any of the nodes, the animation keys are always empty on all the nodes from rootNode to all the childNodes.

I want to get the animations that come with the model itself and manipulate them(play, pause, stop etc.) how to do that?

1 Answers1

0

To apply animations to a rigged geometry model, I recommend you to handle it this way: i.Ex. if your model comes from Blender (or another 3D Suite, but I can only speak for Blender) export the rigged model (without animations) to a DAE format. Then export all the animations as single files (just the animation, but not the geometry and not the rig) also as DAE files. Then you can use SCNAnimationPlayer to apply the individual DAE-Animations to the main Model. They can be smoothly interpolated one into an other. You can vary the speed, repeat them, or play them even backwards.

But before you can use the animations, you will need to convert them properly (this affects only the DAE's containing the animation).

First you need to "Pretty Print" the DAE content of ech animation file: there is a terminal command for this, but I prefear to use Notepad++ with the activated XML Tools. then open your DAE with Notepad++, select XML Tools and choose "Pretty Print"

In a second step you need to remove all the animation Keys. (You will define later a new animation Key that will controll the entire animation)

You can find information how to do this here: (look out for the Link called: Automater collada converter download) How can I export DAE files for use in Scene Kit without seeing "untitled-animations"? (this does not the "Pretty Print" stuff)

Keep in mind, animations can be very tricky and there are several approaches how to trigger them.

ZAY
  • 3,882
  • 2
  • 13
  • 21