Saving cached pose inside specific animation state

For a long time i have a big problem with layered animation system. The reason is that I cannot create cached pose inside specific states, it forces me to make a multiple copies of anim logic. It is very uncomfortable and very bad for perfomance!

I found a same question about this, and answer be like “we are not aware of any particular case when there would be a need to do so that could not be served by caching the pose in the AnimGraph” - this completely wrong. I’ve been a lot of examples over the years when I needed creating cached pose inside specific state.

In screenshot represented example with climbing system where each limb (two arms, two legs) have specific parameters. First i mix all four poses for get averaged climbing animation, then i need same poses for add IK bones layers for each limb, because first mixed pose have averaged positions for all bones, where averaged ik bones have wrong positions relatively ledges.

Questions: adding cached poses inside states planned in future versions? Can i add this feature manually (from changes in source code etc.)

1 Like

What you are asking I think they will not do it, it goes against logic

You have another option, create several State Machine, so you don’t have to duplicate code :slight_smile:

There’s actually a very good reason for this. As it is currently implemented, the “Use Cache” node has to always be able to access the result of the “Save Cache” node. Because the Use Cache node can appear anywhere in the graph if the “Save Cache” were inside a State and the state wasn’t currently active, and the Use Cache was in another state (or somewhere else in the graph) the Save Cache node wouldn’t be executed that frame and the Use Cache would end up accessing a nonexistent pose.

That said, you can always put a Use Cache node inside a state, so what I typically do is move the nodes feeding into the Save Cache into the top-level graph and then add the Use Cache node into any states that require it. It’s worth noting that the Save Cache will only get called (each frame) when the first Use Cache accesses it, so if none of the states that use the cache are active, you’re not doing unnecessary computation.

I would think it would be possible for Epic to add a “Local Cache” that is only usable within the state where it is saved, but as far as I know there are no plans for this.