Download

Input Movement with Root Motion enabled?

Hey, I ran into a snag with root motion and input movement. I want the character to be able to turn while in motion rather than turning in place. I went ahead and
made a video showing my problem. I hope it will be easier to diagnose.

When it comes to turning a character, there appears to be 3 options:

  1. Root Motion which disables input movement when enabled.

  2. Orient to movement, which generically rotates the character. The problem with this is, it only rotates counter-clockwise; setting a negative value supposedly rotates instantly but only sort of. Why isn’t it 0 for instant, positive for clockwise, and negative for counter-clockwise? Also, If animations are tailored to the movement, they snap back without root motion. You can force rotation (i.e. set rotation = 0 or 180) but it doesn’t really set it, it gradually updates ever so slightly enough to be noticeable that it’s flipping the wrong way.

  3. Mirror animations and just don’t rotate the capsule.

Thanks!

https://youtu.be/cQ78qVeehH8

For anyone else stuck in this situation…first I’d like to exclaim. (AAAAHHHH!) Sometimes, and actually, more often than not, Unreal handles what should be rather simple things in the most asinine ways possible. That being said, I wasn’t able to find an answer on this. All the research points to…it’s not possible…sort of. Because Root Motion is data driven and isn’t directly compatible with Character Movement. A few workarounds suggest timing animations to “Enter” and “Exit” the RM portions in a “Seamless” way. Also, anyone looking to replicate RM over a network is SOL because that’s not possible either. You’ll have to write your own method for translating the data driven motion into something meaningful for the CM component. And to add insult to injury, RM doesn’t work with AI characters either – something to do with a field generated by a living organism – I didn’t build the bleepin thing.

All I want to do is turn the freakin character in a way that looks natural. Why is that so difficult in what is praised to be a great engine? If I were writing this by hand, I’d just do the logic as such:

  • If walking left AND not facing left
  • Do animation for turning left
  • Opposite/Same for right

It’s not rocket science–sorry, sorry–just a little salty about my own shortcomings.

Anyway, because RM tends to stop CM, and I need the character to be able to move during this transition, and it has to be variable movement speed which may change based on state and stats, I decided to just handle it manually. I created a turning animation which doesn’t turn at all, the character just mimes and I handle the actor’s world rotation on a tick that fires when turning. This seems to work for what I need. There’s a video below of what I did and what it looks like at the moment. It’s not pretty, but currently functional.

I did try using a timeline for this but had issues resetting the timeline. For some reason, whenever I would try playing the timeline from start, the animation wouldn’t fire. But if I ran the animation from play and reverse, the animations would fire. The other problem was, the lerp was between 0 and 180, which weirdly enough, rotated the wrong way on reverse. Plus I wanted to have variable rotation rates.

Anyway, if anyone has tried a different method that works, please let me know. Thanks!

Video explanation

Blueprint Code – I know it’s not groundbreaking or anything but here it is if needed. As you can see, I’m running each check off a sequence because I want each to be checked independently of one another. The function is called on a tick event so that if something goes wrong, the character’s facing direction is always adjusted.

rm_ex1.PNG

The value of 189 is just a magic number tested for dialing in the correct rotation rate for the animation currently playing. Naturally, this will be set to a variable and swapped based on the necessary animation / state running.