google / model-viewer

Easily display interactive 3D models on the web and in AR!
https://modelviewer.dev
Apache License 2.0
6.71k stars 799 forks source link

A way to add animations to a model (or animation swap between models) #4589

Closed vmt86 closed 7 months ago

vmt86 commented 7 months ago

Description

So, I have a bunch of glb (originally fbx) files, each is one model with a set of animations. What I want is to be able to use the animations from one file, with the model of another file. When I was working with threejs (which I had to drop due to errors when importing models) I could load both models, but only put one of them in the scene, then I would store the other model's animations (clips) in a variable and let the user select which one to play. This worked as intended, but as I mentioned, the models would load wrongly. I tried swapping animations in blender, and exporting the model with the animations swapped into a glb file, which I then loaded in the online editor https://modelviewer.dev/editor/ As well as in my project, and everything works fine in both, so I would like to know if there's a way to support doing it programmatically, if it's already there I didn't find it in the docs.

Version

model-viewer: v3.3.0