Thanks for your answer. It seems that I wasn’t very precise when explaining. The 2D blend space was already inside a state machine, but used only for movement. In the case of attacks, each attack animation has a corresponding animation montage. For these animations, I am using two slots:
Default Slot - All attack montages that have Default Slot selected make the character move only its upper body
StoponGround- All attack montages that have this slot selected make the character play the attack animation with the whole body, including legs.
Here is an example of what I want to achieve:
Notice that when the player presses the S key and character is strafing, when it attacks, it doesn’t turn 90 degrees to the left, it attacks forward. In my case, the attack animation that goes through the Default Slot (for upper body) turns depending on W or D strafing. I could fix this by, as you could see in the script in my last post, detecting movement and countering that animation rotation. However, this is not a good method, since just for keyboard, for a single attack, I would need at least 4 copies of the animation, rotated in different ways (for A pressing- attack turned right 90 degrees, for D pressing- attack turned left -90 degrees, for A+W press- attack turned right 45 degrees, for D+W press- attack turned left -45 degrees). If I add a game controller, this gets even more complicated.
Now, how could I make the character allways play attack animation forward, no matter what is its strafing dirrection?
I have even tried to somehow rotate the root by using Transform (Modify) bone, but I get an error that no components to modify selected, altough I set the rotation for the root to 90. Mabie somehow I could feed in player character control rotation, so the attack animation will allways play forward.