How do I make my character change directions when attacking?

Okay so I’m attempting to make a little hack n slash project, I got the attack string set up and my attack animations have root motion in them. Whenever I attack my character cannot change direction it only just moves forward. I’m wondering how do I go about being able to change directions while attacking just like in commercial games.

Hey there, if your attack animation is using root motion then you can’t do that, because the character is using root motion to get the location and rotation. If you don’t want that, disable root motion for the attack animation and it should allow you to change direction while attacking.

Ahhh, that makes sense, thanks a bunch!

If it’s fixed please mark my answer as correct and if you find it helpful please upvote it :slight_smile:

I know this is an old post but I still want to chime in here for anyone else having trouble with this.
I created an Anim Notify State that toggles “Allow Physics Rotation During Anim Root Motion”

3 Likes

Just implemente this into my project and it just works!!! i have a question tho. Im very new to unreal engine and blueprint as a whole so pardon me for this dumb question but how do i cast the boolean that allows me to rotate character during root motion i will provide a link with a picture if you dont know what i mean

1 Like

100% false.
You can always modify the root bone to shift it wherever you want, independent of root motion usage. This has always been true for all engine versions btw. So it was just bad information to begin with.

Ty. Does that work for UE5 only? Or 4.27 also?

Hi, I am assuming you mean how to Cast to your Anim BP from your Char BP?

Here’s how:

  1. Open your Character BP.

  2. Drag in the Character Mesh from the Top Left panel.

  3. Once that Mesh node is in the graph, drag off it and add the other nodes to the Right, by typing the first letters of their names.

  4. At the CastTo node, drag off the Out pin (teal), and type “set” and “?” or the name of your bool in the Anim BP.

  5. I used a Flip Flop, to toggle that Anim Bool on and off (from the Char BP, when the Player presses the Key). (And there is code in the Anim BP for that bool. So in the Char BP, we are just activating it > then Anim BP does whatever you told that bool to do.)

  6. There is another way to use BPI to toggle Anim bools. (But I’ll need to look in another project for that later.)

Edit: and here is a YT tutorial on setting up Bools/changes in Anim BP.
(I did a different bool that just toggles which Run/Walk to use. So tell me if you need that, the setup in Anim BP is different.)
Omnidirectional Dash - YouTube (after his intro and setup of the Animation)