# exporting multiple animated objects to gltf

I'm fairly new to gltf and am gradually learning about it's abilities/limitations. I am currently trying to test a file that would have multiple objects animate in a scene. However, whenever I export, only one of the objects animates (but if I export them individually, they animate fine on their own).

I read in the documentation that "glTF allows multiple animations per file, with animations targeted to particular objects at time of export. To ensure that an animation is included, either (a) make it the active Action on the object, (b) create a single-strip NLA track, or (c) stash the action." but it's hard to tell if that means one object can animate multiple times, or if you can have multiple objects animate in the one export. As I tested this with no success, but maybe I'm not creating the NLA track properly.

Any help or clarification with this would be extremely appreciated!

Thanks :)

"An NLA Strip animation consists of multiple actions on multiple objects that should play together. To create an NLA strip animation with the name “My Animation”, push the action that should play each object onto an NLA track for that object with the name “My Animation”.

NLA Strip animations will be exported if the Animation ‣ NLA Strips option is selected (on by default). All glTF animations are imported as NLA Strip animations."

The second part of that post: "If you have two NLA tracks with the same names on different objects, you should get a single merged animation out that affects both."

So you have to create NLA tracks and give them the same name. It worked with my animation. good luck with yours!

• Amen to this! I was wasting time trying to combine all my animations into a single NLA action, thinking that was the solution. In fact, it doesn't matter how many tracks or strips you have - just make sure that every track you want involved in a single GLTF animation has the same name. Oct 9, 2020 at 11:34

to export multiple animated objects with armatures, vertex groups should have unique names. here's a little script to rename bones and vertex groups based on parent armature name:

import bpy

for obj in bpy.context.selected_objects:
if obj.type == "ARMATURE":
prefix = obj.name + "_"
for bone in obj.data.bones:
bone.name = prefix + bone.name

if obj.type == "MESH":
prefix = obj.parent.name + "_"
for vg in obj.vertex_groups:
if vg.name[0:len(prefix)] != prefix:
vg.name = prefix + vg.name