Hi all!
Trying to implement animation/blend trees as mentioned in another Babylon Question post: Animation Trees?
Please view the video below at 1:15 for an animation tree demo.
This would allow us to assign one animation to some bones and another animation to the other bones. Something like this is needed to handle situations like a player jumping while transitioning from reloading to throwing a grenade, etc.
It was recommended in Animation Trees? to use two meshes for two skeletons.
This seems difficult when using an animated mesh from Mixamo, since we have to somehow divide the mesh and animations in two.
Also, in our Babylon code, we would have to manage two meshes moving together. If the legs were to crouch, we would have to move the torso, head, and arms the right amount down according to the legs crouch animation for every keyframe.
I tried experimenting in the Playground: https://playground.babylonjs.com/#9VS5TT#6
Please uncomment the 'RifleIdle'
line and comment the 'RifleRun'
line to run the idle animation.
// ybot.animate('RifleIdle');
ybot.animate('RifleRun');
I tried splicing the bones
array in the imported Skeleton. The first line is all the bones above the leg bones. The second line is all the leg bones.
// ybot.skeleton.bones.splice(57); // head, torso, arm bones
// ybot.skeleton.bones.splice(1, 56); // leg bones
However, when uncommenting these lines, the mesh and animation becomes distorted…
ybot.skeleton.bones.splice(57); // head, torso, arm bones
uncommented:
Note: Animation seems okay, but parts of leg mesh completely gone.
ybot.skeleton.bones.splice(1, 56); // leg bones
uncommented:
Note: The
SkeletonViewer
leg bones green outline looks fine, but leg mesh completely gone, and head, torso, arm mesh shouldn’t be moving as much.
Goal: Have RifleIdle
animation play for head, torso, and arms. Have RifleRun
animation play for legs.
Could someone please suggest a way to use animation/blend trees without having to go into Blender and splitting our mesh and animations into two and exporting them separately to .babylon
? Thank you all for your help!