Three.js & Animation & Blender


I have models with animations.
in the zombie model, if you take the code, everything works(gltf.animations[0-2]), and in the knight model there is no.
although the animation array is displayed the same for both of them

(3) [AnimationClip, AnimationClip, AnimationClip]

the model itself is = >
1)how can you make it work in code format?

there is also a 2nd model that is made a little differently in blender
all animations are in one layer
2)how can you do this in a blender with a model knight ?

can anyone have any ideas?

in general, the main task was to take, say, download the model from the mixamo and take 2-3 animations in the same place and make the animations work with this model.

Swapping the code between .load("src/models/knight.glb", ... and .load("src/models/zombie.glb", ..., both models seem to load and animate fine. Have you already fixed the problem, or (if not) could you say more about what is different than you expect here?

If the animation model has more than one layer, then they don’t just animate. As shown in the image, animations dance and die not working in knight model
43533b2b49effa3cb63f606b9ea3f07865a6362a378c (1)

These are screenshots of Blender but you haven’t shared any .blend file. GLB files do not have layers, but they can have multiple animations. If you can share exact steps to reproduce a specific problem someone may be able to help.

The other animations on the knight do not play correctly in, so it seems like the question is related to Blender and glTF export and not to the code you’ve shared.

a layer that combines all animations

Exporting from Blender requires one NLA Track for each animation you want the character to include. If you’ve done that and it’s still not working, then I can’t help debug without the .blend file.

Blend DropMeFiles – free one-click file sharing service

The .blend contains the following:

  1. the knight mesh, attached to an armature with the “Idle” animation linked
  2. a group of empty nodes (not an armature) animated by the “Walk” animation
  3. a group of empty nodes (not an armature) animated by the “Die” animation
  4. a group of empty nodes (not an armature) animated by the “Dance” animation

Since those groups of empty nodes are not armatures, and aren’t linked to the Knight mesh in any way, they don’t export. What you need ideally is 4x NLA Tracks (one for each animation) linked to the same Armature. I’m not sure how to edit the .blend file to get that from its current state, but Blender artists might know how.

I wrote the article below for an older version of Blender, but it might still be applicable as a way of bringing Mixamo animation into Blender and exporting to glTF. The Khronos Group exporter is now built into Blender, and so the references to the Kupoman exporter are no longer relevant: Creating animated glTF characters with Mixamo and Blender

I think this is what i need. Thanks!