I’m having difficulty understanding how skeletal animations fit into babylon. I know that I can tell the scene to play a skeletal animation.
What I’d like to do is to take animations from two identical skeletons, apply one as additive and adjust the weighting.
From the documentation it looks like that weighting is an attribute of an AnimationGroup, and from the limited examples in the documentation it looks like animation groups can only contain simple procedural animations.
Is there a way to get a skeletal animation as an object and add it to an animation group?
I may be able to frame this question better as well. Let me start over.
I have a mesh with additional morph targets and an animation track.
The animation track goes like this:
Frame 0: T-pose
Frame 1-60: idle loop
Frame 61: enlarged skeleton
Then there’s an accompanying morph target to go with the enlarged skeleton. Frame 61 stretches the bones, and the morph target increases the bulk of the model.
When I import the mesh it begins playing the entire file automatically. If I tell the scene to play frames 1-60 it doesn’t work and the mesh import task stops executing, with no error output.
Additionally, when I inspect the mesh object, I can’t find the animations it’s playing anywhere, even in the bones. The mesh HAS a skeleton, but it seems like the skeleton is also imported separately to the scene. Are both skeletons the same reference?
I don’t think I can do any additive blending to apply the enlarged skeleton without a reference to the animation. It’s very frustrating.
Additional issues:
I’ve found the animationgroup for the mesh. I can stop the animation, but if I start it again I only have control over the rate, not the from/to. It just ignores from/to.
importedData.loadedAnimationGroups[0].stop();
importedData.loadedAnimationGroups[0].start(true, 3.0, 1, 60, false);
Okay! On the first loop it plays from To and finishes at From, but after that it just plays from start to end. That’s a bit useless.
More insight: I see in the AnimationGroup that each bone animation track is a child (a track for position, rotation, scale, etc.) That’s good, at least I know where they are now.
- Setting _from and _to does nothing.
- Using start() does not update_from or _to. Playing the animation does not use _from or _to.
- And finally, I can’t even handle it in an observer because the docs do not specify what [target] is in Scene.BeginAnimation(). It’s not a mesh, skeleton or animationgroup because none of those things cause the animation to start playing if it’s stopped.
Finally, the issue appears to be (thanks Scene debug layer!) that GLTF animations in Babylon don’t respect the To and From times, whether they’re entered in frames or seconds.
Part of why I’m hung up on this is Cinema4D only exports a single animation group and I don’t want to learn to rig and animate in Blender.
What I may try to do is clone my file, do the animations individually and then import everything and just use the animation groups on the single visible mesh.
My biggest concern however is this: if GLTF doesn’t support any animation controls aside from start and stop with no arguments, how is additive blending supposed to work?