Hello, I’m having a problem with some simple Animation State transitions logic.
1)I’m in an Idle state, I hit melee attack button which transitions to an Attack state.
2)In Attack state, I play an attack animation sequence
3)After the “TimeRemaining” of attack animation reaches zero, I return to Idle state
This works fine except when I hold attack button down to continually fight. first swing happens and then second swing starts, but transition logic thinks time remaining is finished from previous swing and immediately transitions to end. As I continue to hold down attack key, this circular loop starting/ending happens, and never actually play animation again.
I have attached a pic of simple animation flow. I also turn off “looping” for attack animation. It “Seems” that variables are not reset, or transition is evaluated before second play animation is started…?
Thanks for your help in this matter.
You’ll need to check your MyCharacter BP (or wherever you’re setting melee attack input) in AttackReady to Idle transition to see whether you’re still attacking. You can create a Bool variable in your character BP and cast to it in AnimBlueprint Event Graph. It might look like this:
Hope that helps! Let me know if you have any questions.
Hi , I appreciate answer but I think you are misunderstanding problem. I’m not having any problem with doing an attack button button check.
I tried to break down this problem into a simplified example to relay back to you issue. problem is circular looping. I will try a video to explain it easier as this is a big problem for me. Thanks!
Ok , I have recorded a video showing problem for your own eyes
Video of Looping Bug
more I troubleshoot it on engine side of code, it seems that transition link node doesn’t get to reset timeremaining variable before next evaluation. However, tracing further into engine will take much more time for me to do as I’m unfamiliar with internal framework of statemachine links.
Thanks for video! After watching your video I was able to reproduce issue. It does appear that TimeRemaining variable is not resetting in this situation. I have entered a bug report in our system for our developers to look over (TTP# 348508), and I will let you know when I see any updates.
Awesome, thanks so much! this one is causing me some pain. hehe
Did you ever find a work around? I’m having same issue.
Hey Worrom, actually I did find an annoying work around for this until its fixed. Just add a second redundant state to bypass bug.
I Have been looking into this issue. It is not a bug in state system but expected behaviour. Because on holding your attack button down you make both transitions valid state system will flick between them (giving behaviour you see). We cannot reset play time of animation as you effectively haven’t left attack state yet, we are still blending out of it. only way to get state to reset is to transition fully out of it (using your dummy third state will achieve this for example).
Depending on what you are ultimately trying to achieve there are different approaches to this. simplest solution may be to drive looping param of your “play right claw” node in AttackInitial with a bool (IsAttacking) and set this bool when attack button is pressed and unset it when attack button is released. Then in your transition test against time remaining and whether we are currently attacking. Here are some screenshots of my test case to prove to myself that this behaviour would work (my example use jumping not attacking but principle is same ).
Hope this is helpful to you, let us know if this doesn’t work or you have further issues!