Start Animation gets Interrupted

I press WASD to play a certain start moving animation

If I remove WASD during the length of time which it takes for the start animation to complete it will blend back to idle
But if I then press WASD during that same amount of time (i.e. before the start animation has time to complete its cycle, even if I have just blended back to idle) it will continue where it left off and play the rest of the start animation.

How can I make it do this:

if WASD has been pressed it will play the start animation from start to finish, without interruption?

Meaning you can mash WASD however you like but until you have blended into locomotion or until the start animation has completed itself and you blend back to idle, nothing will happen when mashing WASD buttons?

Please help!

This is all inside my AnimBP

I assume you’re using an animation state machine from within your AnimBP.

What you can do is when WASD is pressed, leave your Idle state and enter a state that plays your Start animation. The transition out of that Start state tests for the completion of the Start animation (via the TimeRemaining node). When that happens, it’ll transition to your Locomotion state. The transition out of your Locomotion state is the absense of WASD, which takes it back to the Idle state.

With time remaining node I experience this problem:

If I release WASD during the start animation it will go back to idle…but if I press WASD again during the time it would have been playing it will blend back into that time during the animation rather than play again.

How can I force my start animation to finish playing once it starts?

Then kind of the same thing for my stop animation but it gets the value wrong. When I remove all WASD keys it will not play the correct animation because it won’t log that W has been hit or SD has been hit…it just records 0 and therefore the stop animation won’t play correctly. It just plays the 0,0 position in the blendspace.

I want to be able to mash WASD during the start or stop animation phase and have no interruption or change in animation. I would like to force the player to sit until the animation is done, and if they are not holding WASD during that time then it will either blend to stop (from start) or go to idle (from stop)…but if going from a start to idle how will it tell which stop to play if the player doesn’t keep holding WASD? It has to log the value whether the player makes it to locomotion or not…so that it can play the correct stop animation which has the same scheme as locomotion (forward, right on a scale from -1 to 1)

Would you be able to post screenshots of your state machine, the inside of your transition nodes, the inside of your state nodes, and the transition times for your transition nodes?

Or post your project, if that’s possible.

This is absolutely possible. It would be helpful to get screen grabs and/or your project first to see what you’re currently doing.

Jumping ahead of myself, one thought is that you could create an animation notify event that gets fired when the Locomotion state is fully blended in. Then, in your anim event graph, you’d catch that event and only then would you allow your WASD bool flag to be reset.

But there may be a simpler solution - just need to see what you’re doing first.

I will upload a video in just a few seconds…

I use root motion so I don’t set speed at all…WASD drives the animation thru a blendspace

W is 1
S is -1
A is -1
D is 1

I clamp it if I am crouching, walking or jogging, or running

so in theory I should be able to press some combo of buttons and it outputs forward and right values to -1 or 1 (which might be clamped depending on if I toggle run or flip flop between walk or jog…or if I toggle crouch)

start and stop take these same values to output the proper animations in those directions which are dictated by the above -1 to 1 values for WASD.

My movement components are different too since I just set forward to forward var and right to right var…no need for addMovementComponent
All this just outputs it as -1 or 1 and I will clamp it to differentiate between crouches and stuff inside the actual blendspace which can hold a lot if I add more than just 4 slices on the graph

Check it out: - YouTube

Hope it is helpful!

The low-res video is a little hard to see, but here’s what it looks like is going on with the Start transition. In the Start to Locomotion transition, you’re ANDing TimeRemaining with the control logic. Which means that if both MoveRight and MoveForward are 0 while you’re playing the Start animation, Can Enter Transition will always be False, and so the transition will never leave. What’s going to happen then is that your Start animation will complete and freeze at the end (or worst, will restart if you’ve accidentally set your Start animation to loop) until you’ve pressed WASD.

Try doing this:

Also, make sure your Start BlendSpace is set to not loop. This way, the transition will leave when the Start animation has (nearly) completed. If you tap WASD, the Start animation will play all the way through, and then you’ll transition to your Locomotion state.

I have no problem getting to locomotion, that is where the time remaining node is.

The problem is going from idle to start…the start animation can be interrupted.

My start blendspace is not set to loop.

There should be 720 on the video right now.

This is just saying if WS or AD are not 0 (i.e. one of the buttons has a value) AND the start animation time remaining is < 0.1 then you can move to locomotion.

i.e. you hold WASD and the start animation will finish playing up until 0.1 then move onto locomotion

I’m assuming that MoveForward and MoveRight are “hard wired” to the WASD keys, so that they reflect the current state of the keys and you’re not caching them, etc.

Ok, so here’s what I’m saying. Let’s say that you’re in the Idle state. You tap W so that MoveForward is 1, and the transition from Idle to Start begins. The Start BlendSpace starts to play. While still in the Starts state, you immediately release W so that MoveForward is now 0. MoveRight is also 0. Ok, so now both MoveForward and MoveRight are 0 while you’re inside the Starts state. So both inputs into the OR node are False, which makes the output of the OR node False. That gets fed into the top pin of the AND node. Anything ANDed with False returns False, and so the output of the AND node will always be False, regardless of TimeRemaining. And since the False output of the AND node is fed into CanEnterTransition, the transition is never entered and we stay in the Starts state forever, as long as you don’t WASD again. So this is a problem.

Looking at your state machine, there is no way to go from Start back to Idle without having gone through Locomotion and then Stops. So what you’re seeing, where it looks like it’s going back to Idle, means that either you’re going all the way through Locomotion and Stops and then back to Idle, or it just appears that you’ve gone back to Idle, but you really haven’t, which could be explained if you’re actually stuck in the Starts state longer than you meant to.

Your Stops to Idles transition has a similar problem. Nix the inclusion of MoveRight and Moveforward, and just wire the output of TimeRemaining to CanEnterTransition.

I did as you said and I understand the true meaning behind and boolean…I have just used Time Remaining < 0.1

But I still have the problem where if I release WASD my start animation keeps playing in the background whereas I blend to idle.
If I release WASD to go into stop animation it will always play the (0,0) stop animation rather than say (-1,0) or (1, 1) etc…because WASD will always result in 0 forward and 0 right as soon as I release the keys and go straight to stop animation. I need to drive the final WASD to the stop animation until it is finished.

My problem is I cannot mash WASD without the animations getting messed up.

To get upon your loop from idle to start to locomotion to stop back to idle…here is a video demonstrating me hitting WASD during the start and stop animation phase…you can kind of make out how the arrow AnimGraph setup shows how starts and stops can be interrupted but when they do where it takes the character through on the AnimGraph

Check it out:

It does need to be fixed somehow.

Yes, that’s the place. And yes, just a name will enable it. I’ve described which slot to use in the post above.

The state machine looks better now. With that fixed, the next thing you’ll need to do is to latch MoveForward and MoveRight so that if both keys are released, you don’t update MoveForward and MoveRight to 0’s until the Idle state is reached.

To do this, you’ll need to add 2 anim notifies to your state machine. Put one on the “Start Transition Event” of the Idles to Starts transition, and call it ExitIdle. Put the other on the “End Transition Event” of the Stops to Idles transition, and call it ExitStops. Compile your anim BP (important, or else your notifies won’t show up in the event graph yet).

In your event graph, right-click and type ExitIdle and create that node. Do the same for ExitStops. With these now in place, your event graph will know the instant you’ve started transitioning from Idles to Starts, and the instant you’ve finished transitioning from Stops to Idles. You can set a bool (Moving) to True when ExitIdle fires, and set it to False when ExitStops fires.

Now that you have that, in your event graph you can do these things:

If Moving is False, update MoveForward and MoveRight as usual.

If Moving is True, and any WASD key is pressed, update MoveForward and MoveRight as usual.

If Moving is True, and no WASD keys are pressed, don’t modify either MoveForward nor MoveRight. Keep them at the values they previously were.

You may also need to add logic in the Idles to Starts transition that only allows the transition to be entered once the Stops to Idles transition has completed. You can do this by simply ANDing NOT-Moving into the rule in your Idles to Starts transition.

This may not handle your Turns and Jumps states yet, but trying to focus on the locomotion issue first. And not sure if I’m thinking through all of the logic, but this will hopefully at least get you pointed in the right direction.

This is where I add the notifies? I don’t have to add any other settings other than a name correct? And which one do I select: start, end, interrupt


I added Start and End Notifies and I set bool “Moving” for those Event Notifies.

Here is a video of what is going on: - YouTube

It is having problems because I can’t hold two WASD buttons down at once, the start and stop won’t play while I mash WASD. (Start because it won’t continue the animation when I let go of WASD, Stop because it won’t hold the WASD values to play the correct animation…it will always play 0,0 on the blendspace)

Any advice?

How do I actually store MoveForward and MoveRight values so that when I let go of them before the stop animation, the correct animation will play? The problem I see with this is it might record W or D if I am holding WD OR it might record WD for the stop value. It all depends on which buttons I release at the correct time.