How to resume an animation just after make transition back to it?

I have a state machine setup in my anim graph. There is an animation called Anim_01. I want to make a transition from Anim_01 to Anim_02. Here, the transition enabled in the midway of the Anim_01 and I need to resume (continue playing the Anim_01 from where it was transitioned earlier) Anim_01 again when it make a transition back to it.

How do I achieve this? Please help

Can you describe more about what the animations are?
From what I understand, you’re asking if the animation transition happens from 50% through animation 01 and then moves to animation 02, when it goes back to 01, you want it to resume from 50%? Typically character animations used in a state machine are made to be looping, and when it blends from one to the other, it makes the transition seamless, but you always start from the beginning of the animation. That’s why I’m asking for more details about what the animations are.

Yes you understood it correctly. I’m using state machine based solution for a combat system to blend between different combat animations. I need to have more control over the blending between animations and transitions therefore using montages are very troublesome. The problem here is when to perform an attack , lets say swinging a sword from right to left and the sword hit by a solid object during the swing lets say that hit occurred when 50% of animation is done. at this moment I need to blend in to a different state where I need to blend the attack animation with a pose snap shot which i was previously saved to give that feeling of that attack actually hit a solid object and bounced back, and after the bounce back is done I need to conitune rest of the swing like normal. I hope you understand the scenario.

Assuming in-place animation

OK so the problem is not with indexing the current animation state but when the state change is required when the game state changes. Typical the game state changes when an event occurs, a button is pressed, collision occurs, and a value is change that represents that change with in the code base.

What this means is the animation changes after the game state has changed so is always running behind and compounds player latency behaviour relative to state changes that has come before or after.

Linear thinking assumes that if you swing and hit an object followed by a bounce the animation is preformed as a point A to point B action so it’s also assumed that you would have to bounce around in the anim graph between animation takes.

The fundamental requirement is to first understand cause and effect and what you need is a fixed value as to the required state change and not so much what you see as a delayed response of an event that has already occurred and based on that value can transition to a number of different visual elements in a controlled manner with in the logic of progression.

Lets take your combat swing.

We first can assume, based on your description, that the swing is not linear from point A to point B and that other game state changes can and does occur with in the same action. We can also assume that over time the action states needs to scale say the swing follows through or miss or is even blocked by the other player. Far to complex to solve with in a state machine as it blending abilities is rather limited as well the use of arguments to enter and exit only adds to the latency problem. Long way of saying it’s to slow.

What we do know is we can create fixed values as to the true game state and using values as a token set the current animation to represent the visual component of the game state.

Just as an example considering you don’t want to use a montage.

What we would want to do is create a series of corrective states based on an unlimited number of actions that could occur which would work well using a blend space. A blend space is nothing more than an index that contains a number of different animations you can blend and switch to using the “token”.

The benefit since the the blend space can scale you just need to add the corrective animation that uses the event token to trigger it and since it’s data driven you can do anything you wish with the values with out having to worry about entry and exit arguments.

Just an idea

1 Like

Hey thanks for taking time to right this solution. If I understood this correctly, there are multiple animation poses or the swing animation with represents the “hit pose” and all those poses are in a blend-space and I have to use a token value at the right time to blend in to one of hit pose (most appropriate one) and reset the tokens value after some time is passed? Am I correct?

BTW, i was trying to find a solution for this before you wrote this solution. I was able to do what i mentioned in the question by using “blend poses by bool” node. it actually made the animation resume after the blend is done. It’s not “perfect” but seems to get the job done.

I’m just wondering now your solution is better one right now (if i understand it correctly)

As an approach to logic building that’s more or less the idea. What we do know is the games state always changes “before” the animation is played so whatever is controlling the state changes can notify the animation blueprint as to which animations to trigger.

The only thing questionable is most times the token value does not need to be reset as it’s only held until the next state change. Most times you would want to hold a state until the animation has time to complete. The honest answer can only be figured out via discovery and the iteration process :wink:

As you noted “blend poses by bool” works for you which is along the same pathway towards being data driven and if solves your problem I don’t see this as being better as one over the other but more of a question as to how it would scale if you need the channel to do more than just two options (melee in full)

I use the blend space idea to demonstrate how a group of animations could be indexed as to the idea of context animation sets as it blends with in it’s self. You could for example could make a tree along the Boolean idea but use blend on int instead. You could even use an indexed variable array instead containing takes or Montages.

I use a variable array for example to trigger random taunts.

1 Like

Absolutely, I agree with you the blend space is the most scalable solution here . I’m in prototype stage so I’m going to try it again with blend spaces to see what’s best for my scenario. Never thought about a blend space related solution until you mentioned here ! Thanks again for that :grinning: