I have the following State Machine configured in Paper ZD for my player character so his Idle, Run, Jump, Fall etc animations can play, all of which work.
The first problem is the new working swimming mechanic isn’t using the flipbook I set up because I’m not sure where and how to integrate it into my State Machine.
The second problem is, the player also needs to be able to go left or right(X value) and have the same animations play, which is essentially the code at the top of the screenshot but again, not sure how to integrate.
The third problem is the state machine needs to know that the player is in a ‘Water Volume’ before these animations are allowed to play.
Instead of manually setting water volume var, you might want to use actual physics volumes instead of generic box overlaps. Should be able to find them in the volumes category of place actors menu. Just drop it into map, tick the water box in details, and character movement should change itself to swimming when you enter it.
For the animations, in your state machine, you can get “IsSwimming” from the charcter movement component similar to how one checks for walking or falling. Then simply use that ISwimming bool as a transition rule.
That cleans up my logic for swimming, but now I need help to actually play the flipbook, I’m not sure how to integrate it into my other movement logic?
This is probably the solution, but the documentation is out of date, or at least missing key information. I was stuck for 10 minutes just trying to work out how to make the Output ‘Paper Flipbook’ an array and even then there is no way to just create variables from it for each flipbook so I’m stuck at step 9. as I have no idea where it suddenly gets these variable references from.
Yea, the docs could use some love. As for setting the flipbook though, you could just set them with a select node and manually pick the asset base on the results of state function. could be tedious with multiple characters, but preobably less painful than making arrays of flipbooks:
The anim state function there just has to branches in it to check for IsFalling and velocity, then sets my AnimStates enum accordingly.
I’ve not used it myself, but there’s a free plugin on the marketplace which apprently has 2d anim blueprints similar to the native skeletal mesh system. Might be worth checking out.