Hey guys very new to UE here so in my top down game i have movement set up very similar to games like POE II (WASD setting) where the player is always facing the cursor location, I also am using a blend space for all running animations based on the player’s movement and orientation. I’m trying to figure out how to set it up so that the dodge animation also changes based on the character’s orientation. For example right now in my character BP when my IA_dodge (spacebar) is pressed AND W is pressed then a forward dodge roll occurs (via animation montage). this works if the character is facing north but I’d like to make it so that if the character is facing to the east that same action (space + W) turns into and Left side roll, same for if the character is facing south then then W + spacebar = back roll, if that makes sense.
most tutorials around dodge say to use montages which seem to work well for 3rd person where the camera is always the director of orientation so a W press always means forward roll, but in my top down game the camera is locked and depending on where the cursor is pressing W moves the character north but might mean strafing to the left, backing up or simply moving forward. this orientation dependent dodge roll is basically the set up for top down games such as POE II with the WASD setting on, just trying to figure out how to emulate that. Thanks!
(I also thought about making a blendspace and tie it to a Dodge State but I can’t seem to use Input Actions to trigger state changes)
Animations for such momentary actions should be played as montages. The blend space approach you were planning on won’t really work due to the nature of this mechanic, because it’s not fit to be played inside a state in your state machine. You’ll probably want it to be played over an over when the player spams input. Aside from the obstacles, it’s also much more convenient and logical to handle this mechanic in the character blueprint instead of the ABP.
So just duplicate your input action for movement (you can have multiple of the same IA node, it won’t cause any issues unless you’re executing logics that might affect each other), and use Branch nodes to detect if the X component of the movement input is either greater or less than 0 (don’t check if it’s equal to 0, just greater or less, NOT greater or equal / less or equal), and also do the same for the Y component of the movement input. Note that I said the movement input, not the Action Value. Don’t evaluate the X & Y components of the Action Value, evaluate the result you get after rotating the 2D Vector according to the cursor location.
Check out this post of mine to see something similar (Again, in your case, you’ll need to do the same for the movement input, not the action value. That logic checks if the movement will be lateral or not btw, so you’ll need to use 4 branches)
Then all you need to do is to play the corresponding anim montage!
About Montages
You can create an anim montage by right clicking on your animation sequence from the content browser, hover over the Create section on the menu that pops up, and hit the Create AnimMontage option. And don’t forget to have a default slot plugged into the main output pose of the Anim Graph in your anim blueprint. You can get that node by right clicking on an empty space in the anim graph, search for “default slot” on the menu that pops up, and hit the "Slot ‘DefaultSlot’ " option. Now in the Event Graph of your character blueprint, you can play the montage by either using the Play Anim Montage or the Play Montage node. As for the former, just select the montage from the dropdown menu on the Anim Montage pin of the node. For the latter however, make sure to plug in the SKM into the In Skeletal Mesh Component pin. You can drag the SKM from the Components window on the top left into the Event Graph.