Hi,
I’ve run into an issue with a 2 state Anim State Machine.
The first state has nothing in it, and an immediate transition to the second state.
The second state has a switch on Enum blend node that selects an animation and plays it.
It has an OnExit event that swaps the enum Value to the value it isn’t.
The transition from the second state to the first state simply has a
GetRelevantTimeRemainingRatio < .1 transition.
Expected results:
The animation switches between anim 1 and anim 2 playing each until >90% of the anim has been played.
Actual Results:
The first animation plays, and transitions to the second animation, which plays, at which point the character freezes.
Cause:
Stepping through the code, the code for GetRelevantAnimTimeRemainingRatio calls:
GetRelevantAssetPlayerFromState() which iterates through the AnimNodes for each anim in the enum. It then calls
GetCachedBlendWeight() which returns 1.0 for both anims. Since Anim2 comes after Anim1 in the loop, it is not selected, and the incorrect animation is being checked for this function.
Thus, the GetRelevantAnimTimeRemainingRatio() function is checking Anim1 while Anim2 is playing (and anim 1 is always at 0% played in this case) so the transition is never taken.
Workaround:
I have implemented a crappy workaround which involves putting AnimFinished Notifies in every anim, and then triggering the animation transition off of a bool from those instead of off of The Relevant time.
I can work at providing a sample project if this is insufficient information, just please let me know!
Thanks in advance!