Animation not traveling after pressing right

Godot 4

I set up my player so that it would return the idle animation if I’m not currently moving. Thinks works in every direction except right. If I start moving right and then stop, it will pause the running animation instead of returning to idle.

You use a different input function for right. Try matching the others.

They originally the same function, I just changed the right one to see if using a different function would fix it.

I guess it may be a animation tree issue then re reading your problem statement. Maybe check the blend factor.

How would I check the blend facor?

I can’t remember the specific name but there is a blend2d or blend1d node in the animation tree that handles the animation state. There are raw values. (Typically from 0…1)

You reference them in your code.

The other thing is probably the animation state machine, if you use one, is there an expression that will transition back to idle if run blend is set to 0? It looks like you use travel function. So maybe not that…

If those are all okay it could be that the input vector fails to be compared to zero. (.i.e its not completely zero because floats work weird sometimes.) So the character looks like he stops but he is moving incredibly slow.

You could try a vector approximate comparison.

If not InputVector.is_equal_aproximate(Vector2.ZERO):

This is my state machine for all the animations (“idle” and “run” are both in “MOVE” dependant on if the character currently has a velocity or not.
Screenshot 2024-04-25 at 12.43.04

And it appeared that the aproximate function didn’t work either, did I implement it correctly?

1 Like

Okay, what about moving the set blend parameters outside the if statement. It seems strange not to set blend state for idle if no input is set. They would all get stuck in the last input vector direction.

I moved “run” outside the if statement, (if I moved all of them it broke more). However, It didn’t fix the issue.

I don’t know what else to check without seeing your animation tree.

At least from the code provided the logic looks mostly correct. (I still think you need to order the blend setting differently but that all really depends on your animation tree.)

Basically it seems like an animation problem, this code looks mostly good, so the problem is probably not where we are currently looking.

I just looked, and it was a problem with my idle blendspace. I just deleted it and remade it and it worked. Thanks for your help.