State machine transition blend works into movement but not back to idle.

I have a very simple animation blueprint for a character, and it all works great. However, the transition blend in the state machine from Moving back to Idle doesn’t blend, and I have no idea why. Here’s what I’ve got:


The event graph just stores values from the pawn for use elsewhere. Not all values are currently used, but none of them should be causing the problem.


Here in the AnimGraph, I’ve got an UpperBody slot set up to be able to be used/not used via a boolean. Also not a problem. Works great.


Here in the state machine, I’ve got the transition that isn’t working selected. I’ve checked and double checked that it matches the one going to Moving, other than the condition of course, and everything looks fine, but it doesn’t Blend from Moving to Idle.

(Edit: To clarify, the transition itself works, and I get back to Idle state. But it isn’t Blending the transition back, where as the transition to Moving is blended nicely.)


Here’s the settings of the transition from Idle to Moving, and it works perfectly. The character blends into its movement blendspace as expected.


So I assume if everything else looks good, the issue must be in the Idle State somewhere, but I can’t figure out what’s wrong. O_o…

Hey @WillWeaver!

Try going into that blend that isn’t working and setting the velocity to NearlyEqual 0! That’s what tends to have to be used with animations :slight_smile:

I’ll give it a shot, but I think I might need to clarify the issue. The transition itself works fine, it puts the state back into Idle. It just doesn’t Blend the transition back to idle.

AHHHHHHHHH Okay! Now I smell what you’re steppin in! :slight_smile:

Did you try turning the duration on the blend up higher?
Also if you are transitioning at 0 velocity, you will only start the blend into idle when COMPLETELY still. Have you tried using a blendspace for this?

I have extended the blend time to confirm it was working going from Idle-to-Moving, and it had the expected result. But no matter what I set the blend time to going back to Idle, it just snaps back into idle animation.

I have not tried using a blendspace for the Idle, as I just needed the character to go into either a “Battle_Idle” or standard “Idle” animation, so using a boolean to pick the idle animation seemed like the logical choice.

I haven’t had any issue with it getting back to the idle state.
The characer is AI controlled NPC, just moving with “MoveToLocationOrActor” on a timed loop to get a random point. When it starts moving it blends from Idle-to-Moving just fine, just not going back.

Edit: I extended the transition times to 0.8 each on the transitions and took a video to show the issue:

This sounds perfect for an “Idle/Run Blendspace”! They’re pretty standard for this sort of thing, it’s almost necessary for a slow down if you don’t have an actual “slowing down” animation.

If it only has a forwards movement, you can just use a Blendspace1D with 2 anims, idle at 0 and run anim at wherever you want, then plugging in “velocity” as your float input. That way it’ll auto-blend up and down based on distance from 0. :slight_smile:
image

Sorry, I didn’t see that video get added until I was finished with this reply. One second.

Yeah, I can definitely give that a try and interp the value as needed in a blendspace. I just wish I understood why this clearly straight-forward function in the transition that works one direction doesn’t work the other way. :stuck_out_tongue:

Okay! What kind of moveTo are you using and where? Because you may actually have an issue with the movement itself dropping straight to 0 instead of slowing down. Have you tried modifying the deceleration/brake in the Character movement component? That could be an issue.

This is what I’m using to make the character move. Before this is just a “GetNavigablePointInRadius” to set where “WanderTarget” is.

And I did just double check the AI_Controller to make sure I had no code in it that could be causing an issue.

I have no problem with the actor stopping instantly, but even if it does, my thinking says the character should slowly blend from running to idle even if the root character is stopped instantly.

And regarding the Acceleration and Deceleration, both values match. So its speeding up/stopping at the same rate, just not blending the animation.

I think I have an idea of what might be the issue, but I don’t understand why it would be an issue.

In the Moving state, I’m using a full blendspace with the standard Idle in the center when Forward/Right are both 0. And when increasing the Blend time for that transition, it does slow down the change from Idle to moving.

However, the blending feature in the transition might not work if I’m telling it to go to just an animation asset. So I’ll try replacing the Idles with a blendspace as you said and see if that changes anything.

*Edit: No beans. Made the blendspace, used the InBattle bool to select the value of the blendspace, and it still snaps to the idle animation. :\

I mean the idea here is that you have a “Non-Combat Idle/Run” and additionally a “Combat Idle/Run” Blendspace blended by an “IsInCombat?” boolean. All that can go in a single state, so you don’t have to worry about transitions, or you can have the bool be a condition to switch between “Non-C” and “In-C” states. Either way should work. But what I’m thinking is since they move so slowly, what about opening their character/pawn movement component and just lowering their brake speed so they start slowing down earlier, as well? Give more time for the blend to be apparent?

I’m confused, where does a bool fit on your blendspace? Should be passing in a float. Can you show me a screen snip of your blendspace?

Capture
Here’s where I was using the boolean. The game uses encounters for combat, so they never need to smoothly transition from one idle to another. When they’re in battle, they just need to use the combat idle.


See, I thought the issue might be that using the animations directly wouldn’t accept the Blend Logic here in the transition within the state machine.


But, the blend logic in the transition TO Moving works perfectly. Even if they suddenly go to full speed, the animation is still gradually blended from its current to running. Just not the other way around. So the Blend Logic works one direction, but identical settings on the other transition don’t blend the animation.

Now, what you suggested is a perfectly functional work-around to use the velocity to blend the animations. I get that perfectly. I just figured that since the transition blends work one direction, it should work the other way. :stuck_out_tongue:

Right, which seems like it would work. Animation engineering is a finnicky, nit-picky process.

This is what I’m talking about doing, here.

image

I don’t know if this helps you or not but it might be an easier way. Transitions are just so finnicky I try to avoid them whenever possible. :slight_smile:

As far as the instant idle, I’d say turn down your character’s brake, so they’re forced to slow down to a stop instead of stopping on a dime, as acceleration is definitely affecting the movement. Paired with Blendspaces that should do it.

Adjust these values found on the Details tab of your Character’s Character Movement Component.
forum

2 Likes

Hey @rooogel! Thanks for contributing, and welcome to the forums!