I’ve always wanted to know how to export the model with a variety of animation, I use Maya export model has a variety of animations, but they are in the same time axis, I only by controlling the time to change the animation, it is not what I want. I hope to get multiple timelines on the same model and control different animations by weight. It’s kind of like the model in this demo.
Related: ClipAction select range to play
Since Maya can only export a single animation track (with FBX at least) you have two options
-
Create one long track with all animations in a row. Then use @donmccurdy’s experimental PR to split up the animations after you load the model: https://github.com/mrdoob/three.js/pull/13430
-
Export the model multiple times with one animation one each version. Then extract the animations, save them as JSON
AnimationClips
and load them up alongside the model. If you go for this option you can use my loader to extract the animations: https://blackthread.io/loader/
Load up the model and click the save icon in the bottom left.
The better option here probably depends on how your model is set up in Maya. I would favour 1., but that PR is largely untested so you may come across problems.
It’s very early in development, but this Maya to glTF exporter does support exporting multiple animations to glTF directly from Maya. If that doesn’t work, I expect the authors would appreciate bug reports.
Oh, yes, thank you very much. I think I understand. I’ve been thinking about how the model poured out a variety of animations, and I’ve always been in the wrong place.
For getting multiple animations into a glTF file, I have been exporting an fbx from maya using the game exporter, that splits the animations up into a single file.
Then I use the following FBX to glTF tool.
https://github.com/facebookincubator/FBX2glTF/releases
This outputs a glTF file which, when loaded using the ThreeJS glTF importer, gives an array of animations that you can use the AnimationMixer to control playing/pausing/blending animations in.
Oh oh oh! This is cool! Thank you very much!