Walking animation direction

I think this might be quite complicated. What I’m trying to achieve is that animations work like in Unity.

I don’t know if you guys know how does Unity’s animation system work but this is how it looks:

I’m trying to blend the walking animations as in Unity. For example:

There are 2 axis in that plane(X and Y).

Lets say “WalkForward” is (0,1), 0 in the X axis and 1 in the Y axis.

If we apply the values (1,1), Unity will blend the animations “WalkForward” and “WalkRight” making the animation look like it is walking diagonally(forward and right). If we apply the values, lets say (0,1.5) it could mean “Sprint” or something.

You can blend multiple animations in Babylon.js similarly using weights.

1 Like

Yeah but that is too simple and doesn’t work like the 2 axis method in Unity.

There must be a way to do it in Babylon right?

As @taulmarill mentioned, animation blending with weights can allow blending between WalkForward, WalkRight, and Sprint (each with a weight from 0.0 to 1.0)

For example, if a player is moving forward right, you could use weights of 0.5 for both WalkForward and WalkRight

Maybe I’m misunderstanding the full requirement

Yeah but how would you code it?

I guess this is more about a math issue.

Here’s a PG example of animation blending with weights: https://playground.babylonjs.com/#IQN716#9

What I’m talking about is something like this:

See how the animation adapts to the direction the player model is “looking” at?

If it is looking at the right and then moves forward(relative to us) it will animate “WalkLeft”.

Not gonna lie, it seems quite complicated.

1 Like

Thank you to @MackeyK24 for implementing the export of Unity’s animation system to Babylon: Animation/Blend Trees? (Part 2) - #14 by Thibaut

@_Cri5 perhaps you could check out MackeyK24’s Babylon Toolkit?

1 Like

Thanks! But I think I got a simpler solution. I’m gonna work on it to see if it works.

Thanks for your help anyways :slight_smile: .

1 Like