How can we mix character animations and control precedence?

greetings fellow babylonians! we’re working hard prototyping our new multiplayer game project, humanoid at https://benevolent.games/, and we’re currently focused on character animations

humanoid

we need help understanding babylon’s animation system for rigged characters.

we successfully have walkcycles playing and happily mixing together, using animationGroup.setWeightForAllAnimatables(weight)

however, now we want to override the walking animations with important animations, like lookupdown, wave, and eventually things like weaponreload etc.

we need to keep the walking animations at weight 1, because values less than 1 are not “fully expressed” — so we need to figure out how to leave the walking animations intact, while also playing important animations that will totally override animations for the arms, etc. these override animations are currently setup so that they only have keyframes for the relevant bones (like the arms).

our source code for the animations is right here in load-character.ts

our current problem is playing the idle animation, then overriding with the walking animations, and then overriding all of that with the all-important lookupdown animation to take full precedence over the bones it has keyframed.

what we really need is something like “animation layering”, where we can have layers containing blended animations, such that each layer can have precedence over other layers.

we’ve read as much documentation as we can find, but we need help understanding how to properly leverage babylon’s animation system. feel free to drop into our discord, and we’ll post back anything we learn here in this thread so that others can learn :slight_smile:

:pray:t2: thank you

You may have a look here - GitHub - ssatguru/BabylonJS-CharacterController: A CharacterController for BabylonJS
The demo: CharacterController Demo

2 Likes

thanks for the link, i’m looking through its source code now.

however, i’m not sure if this demo is capable of layering additional animations on top of the walking-oriented animations?

in our project, we already have achieved blending between different walking animations — but our problem is with layering additional higher-precedence animations on top of those animations — so that our character can, say, reload a weapon while also walking.

Hi!
@Deltakosh is explaining here how the skeleton animations works in detail. Check it out!

EDIT:

Here is an example how can you get the low level data for the animations and play with them :slight_smile: Maybe it’s worth to check:

2 Likes

thank you for the resources :slight_smile:

maybe this weekend, i’ll see i can prototype some kind of “LayeredAnimationCoordinator” that deals with the animations on a lower level, providing an ergonomic interface for layering sets of blended animations together in a controlled way.

if my prototype is successful, maybe one day we can improve it and add it to babylon :beers:

4 Likes

Keeping my fingers crossed and good luck with it! :beer: :beer:

Hello @chase-moskal just checking in, was your question answered? :smiley: