Hi everybody!
In Blender I created an Action with a walk Animation using only the lower body part, no Keyframes are set
for the upper part. A second Action lets the Character grab its Sword from its Back - this Action just has
Keyframes for the upper body part.
I’d like to use the AnimationMixer to play the walk animation and then use the “grab sword”
animation to let the character pick up his sword. The sword-animation will be used in many situations, not
only when walking, but also when running, idling or sitting. So the leg-movement animation needs to
be independend from the arms animation.
When exporting to glb I find that for every animation ALL the bones get keyframes and when I combine
them, the walk animation is messed up, because it gets mixed with the static leg positions of the
“grab sword” animation. Also the grabbing of the sword does not work well, because the arms are in
T-pose for the walk-animation and this pose gets mixed in, too.
I’ve read that I would need to uncheck “always sample animations” in Blender to prevent the
Bones without Keyframes of being exported, but when doing so the animations do even more crazy
things and are completely messed up.
I also tried fbx Export - but this creates Keyframes for all Bones for all Actions, too.
Is there a preferred way to solve my task? Maybe an idea on how I could fix the animations
when “always sample animations” is unchecked? That would be great…
I’d really like to read about your ideas on how you would solve this problem.
Thank you in advance!
1 Like
Until I come up with a better solution I now remove the Tracks without an Animation from the loaded Model. This works great and lets me combine the Animations as I need:
this._gltfLoader.load(url, (gltf: GLTF) => {
gltf.animations.forEach(anim => {
for(let idx = anim.tracks.length-1 ; idx>=0 ; idx--) {
let track = anim.tracks[idx];
let numElements = track.values.length / track.times.length;
let delta = 0;
for(let i=0 ; i<numElements ; i++) {
let valList = track.values.filter((value, index) => (index % numElements) === i);
let min = valList.reduce((a,b) => Math.min(a,b), valList[0]);
let max = valList.reduce((a,b) => Math.max(a,b), valList[0]);
// Sum up all absolute changes in this track
delta += Math.abs(max-min);
}
if(delta === 0) {
// This track has no animation on it - remove it
anim.tracks.splice(idx, 1);
}
}
});
//
});
1 Like
Hi!! I’m trying to combine facial animation with body movement and I’m having the same problem as you are. Did you find a way to do that? Thanks!!!
1 Like
If you use Morph Targets for Facial Animation and Bones for the Body, there should be no interference. Otherwise, if you use Bones for all animations, make sure you leave only Tracks in the Animation where changes happen (see my last Post above) - this way bones not contributing do not get pulled to a position.
E.g. walking Animations only alter the lower body and gesturing only modifies arms and hands. Without removing, the walk Animation would provide Rest-Positions for the Arms and mixing these with the Gesture-Animation will mess up the final Animation.
For my case it was quite complicated to get working for all cases, so at the end I just chose to live with some inconsistencies.
1 Like