I’m working with the anim component that was introduce with PR#2007 and I’ve got to say it’s a massive improvement to the previous workflow. However, I’ve been browsing through the PR and while I’ve seen Blend Trees being mentioned a few times I haven’t found anything that explains how they would be set up.
I’m not super familliar with animations, but in Unity the type of tree I want to create is called a 2D Freeform Directional tree and it allows you to declare animations that should play on a graph via a 2D vector. Example below:
With this tree if you were holding (W and D) [traditional WASD controls] it would blend between the run-forward and run-right animation to create a run-forward-right animation effect. This makes movement in games feel very fluid. I’d really like to finish getting the fluidity of our character ironed out so we can move forward with transferring the remainder of our client to PC.
Right, that’s what I’ve noticed as-well is that it seems to only handle animation blending between states, and not blending on animations together. However, in the engine code there’s the AnimEvaluator which is declared on L798 as of commit b7940368c279108366fbace403f91e5fcb4fd8df
I’m not familliar with the inner-workings of animation, but the in-code documentation states that it’s for blending two animations together. With that being said, if we were able to get a % blend from each animation, creating a Blend-Tree would be quite simple in theory.
I haven’t experimented with this just yet, but if this works how I assume, then you should be able to generate a clip on-the-fly based on your inputs. For example x: 1, z: 1 to generate walk-forward-right based on some sort of radial math to choose the % of each to use for the blend.
This is, unfortunately, all the things that I’ve been spoiled with in the mainstream engines, so I’m not sure how to do it.
Being able to have a blend-animation play during state walk for example, would be huge for responsive feel.
Well, it is really one of the things I’m looking for.
Yet, I’ll share with you a workaround that came to my mind. Not long ago, I’ve created an animation splitter tool which creates animations out of a single animation. I read all the information from an animation and just copy the keys I want.
What you can do is create a new animation, read the keys from both animations, add them together and divide by 2. Then, just use the animation current time to make sure you are on the same frame when you switch between animations.
Of course this won’t allow you to use a percentage of each animation, but it gets some of the job done.
Hope that helps.
This is the animation splitter thread if you are interested in reading the code:
Blend trees are on the list to be developer in the next few months, but has not been done yet. Please stay tuned. Other parts of the animation system are being worked on as well - such as state graph editing in the Editor, and curve editor and others.