How do you stop an animation in the state machine?

I just finished the FPS tutorial and don’t like how the running animation finishes even after you stopped moving. Is there a way to fix that? I tried using a Stop Anim node but I can’t find a way to call it as there is no output exec to use.

Sounds like you would like for it to transition to the Idle sooner/faster, not really to ‘stop’ the animation. There’s a couple things that you could try.

First, you can adjust the duration of the transition from the run to the idle, basically that’s the time that it takes to blend from one state to another. You can find this in the details of the transition under BlendSettings. The default is 0.2 which can feel too slow in many cases.

If it still seems like the run is going for too long after the character has stopped moving forward, you could change the variable that fires the transition. I think right now, the run animation state is active until the character’s speed reaches zero. You could change that to return to the Idle state when the character’s speed is less than 10 or 15 or something like that.

Good luck!

I tried setting it to 0 but that didn’t seem to change anything. As for changing the speed comparison, how would I go about changing the BP to support that? I was going to try getting the local player’s speed and then checking against that, but would that not work if someone spectates that player, etc?

I’m not sure how your AnimBP EventGraph is set up, but it should be really straightforward to get the speed as a variable. If you look at the AnimBP EventGraph in the First Person Template, you can see it is checking if the velocity is greater than 0 in order to set the bool IsMoving. You could simply change that to store the vector length of the ‘Get Velocity’ node in a float variable. Like so:

Then use that speed variable in your transitions. So like, ‘Speed’ < 10, or whatever looks good.

Your concern about how a spectator would see the animation shouldn’t be an issue because the values we’re getting in the EventGraph are from the ‘pawn owner’, basically whoever/whatver owns this anim blueprint whether it’s the local player or another player or an AI or whatever.

Hope that helps!