How Blender exports two separate NLA grouped animations in GLB fomat

I created a simple piston model in Blender, then bound the bones to the model, created a bone binding animation in the NLA editing panel and generated a separate action block, then created a keyframe animation for the model and also generated a separate action block. When exporting the glb file the animation model selects the NLA track, but when previewing I realize that the two animations are not running independently, how do I fix this?
Example of the correct running animation:
想要的运行动画
Example of a properly disassembled animation:
想要的拆解动画
Example of an error:
错误的示例

My Source Files:
Demo_Blender.zip (1.9 MB)

1 Like

cc @PatrickRyan and @PirateJC who might know the Blender trick

1 Like

@Buugeed, from what I am seeing in the sandbox, my guess is that you have a parent bone that is handling the explosion of the parts and child bones that are doing the animation for each part when the motor is running. I am also guessing that you have key frames on the explosion bones only in the animation for the explosion. Additionally, I am guessing that there are no key frames on the child parts keeping them in their default state in the explosion animation.

Basically, what is happening is that since you only have key frames on your bones in some animations and not others means that when you move to an animation that does not have keys for translation, rotation, or scale for a bone, it will remain in the last known pose until it gets new information. If you want to reset your animations for your explosion animation, you need to make sure you have keys on all bones to ensure that your parts return to their original pose for explosion. And it’s good practice to put keys on the translation of your explosion bones for all other animations to make sure when you go from an exploded view to a running view that the parts snap back together.

Granted, if you wanted your parts to continue moving while exploded, what you have is the way to do it. You can play both animations at once, and your parts will explode while the run animation continues. I hope this helps.

@PatrickRyan Thank you for your answer, because of some special reasons I can’t follow the way you said to realize, if I set the keyframes of the blank position also this will lead to my animation doesn’t meet the needs of the product design, I want to have a plugin that can export animation grouping settings through the range of the keyframes in Blender, like the BabylonJS_Exporters tool that was developed for Maya or 3D MAX. Exporters tool for Maya or 3D MAX, for example, you can set the running frame of the first group of animation is from 0~10, the running frame of the second group of animation is from 11~20. I don’t know if there is any official plan to develop a similar Blender plugin?

@Buugeed, I understand that there are reasons for wanting to keep key frames off animations that don’t need them. Even from the standpoint of file size, authoring keys on frames that don’t change will bloat the file. I am not sure I am understanding your concern here, though. It sounded in your original post that you were concerned about your exported animation not being right when testing in the sandbox. But now it sounds more like you are concerned about sequencing the animation, though I could be wrong about that.

The simple question to answer is that we do not intend on building any export plugins for Blender. Blender has native glTF support so there is no reason for us to invest resources on making something for Blender. Even our Autodesk exporters are on maintenance only mode. We will fix bugs, but we are not actively developing anything new for the exporters because we know that native glTF support is on the roadmap for Autodesk. We have no idea when it will come, but investing in an exporter that will be deprecated at some point in the future does not warrant investment in exporters over other priorities.

If you need to sequence the animations between your states (running or exploded mode) you simply need animations to return the spindle back to the start position so you can explode and re-assemble the parts from the exploded view. This could be something as simple as making sure the motor completes its rotation before moving to the next animation by setting an observable on the end of an animation group. You can set it up so that at the end of the animation you check a flag to see if you play the run animation again or move to the explode animation. This way you will always have your motor in the neutral position before you explode.

For the explosion, you simply need an assembly animation This could be a separate animation if you want the assembly to look different than the explosion, or you could play your explosion animation with a negative playback speed to reverse it. If you get user input that they want the motor to run, if you are in exploded mode, you would play the assembly animation first and then go to the run animation.

In terms of exporting animation clips, I think the way Blender handles it is through NLA tracks if I remember correctly. Each NLA track can be exported to a separate animation, much like the animation groups feature in the Max/Maya exporter. Since we are taking the animations from the single timeline, we can isolate different parts of the timeline to be different animation groups. But when we export, glTF uses actual time in seconds rather than frames to describe an animation, so we don’t have a concept of what frames the animation came from.

Not sure if this actually answers your concern or not, so please feel free to add more context to the problem you are solving and I will try again.