Mecanim Style Root Motion Navigation in Unreal?

I have a set of animations that I made for my project when I was in Unity using their Mecanim system. These animations are root motion navigations for directional movements that also use rotations, such as walk/run/sprint while turning 90 or 180 degrees.

This is an example of the setup and effect I would like to achieve: Unity 4.0 - Mecanim Animation Tutorial - YouTube

There’s a ton of subtlety in the leaning and weight-shift of these animations that make it look incredible in Unity, but I’m wondering if this can be achieved in Unreal.

I have heard from guys who have used Unreal for years that if I make a Speed/Direction blendspace, Unreal will look at that as strafing and won’t understand what I want to do with the turning. I would imagine that anything is possible with blueprint, but I wanted to know if anyone had successfully made an animation system like this, or if there’s a good way to go about creating something similar. Thanks!

Can UE4 achieve a “NextGen” level of animation? You bet but authoring is stuck in the mud at the moment that is in need of a serious middleware or plug-in solution.

The basics of Root Motion is it’s a stand alone data set that contains both speed and direction changes that “only” needs a direct input, like a key being pressed, to change the state that if tied into and authored as part of a blend space it “would” be super easy to build 8-way movement animation systems.

Overall though the Epic has not stated any road map as far as improvements geared towards Root Motion goes, serious consideration as to network and replication requirements a must have, and not as slick as Mecanim but the basic building blocks are there using blend By.

In 2020, has this been updated? This is very easy to do in Unity but I can’t find the function names I need to call to get the information I need.

Basically, I just can’t find out how to do these two things:

  • intercept a root motion’s desired displacement/rotation
  • intercept the navAgent’s desired move, and set it to match the root motion’s movement instead
  • something like Unity’s agent.Move(displacement vector) method that will move the agent, but also constrain the agent to the navmesh

Where can I find these functions/properties? I can’t find another thread that isn’t locked because somebody starts a flamewar or everyone saying to ‘not do it’

Eg, imagine a zombie limping along without root motion - it would look terrible.

eg, from a 2015 thread
“Real world advice. Do not even bother with root motion, especially in Unreal. You will waste increadible amount of time for zero benefit.”

Intercept?
if you mean extract you can read the bone location and direction.
if you want to know a value in the future you would have to code your own CPP to extract it from the animation track based on the bone name.

The second intercept, I’m not really sure what you are doing to be honest.
you probably just want to replace the max movement speed with the speed value derived from the root motion curve.
The location and direction is handled by the engine with the nav mesh, usually.

And thats the third pin. Ue4 uses simple ai move to, or other ai based movement that is tied to the navigation mesh.

And their point about root motion is inconsequential, but it takes way less time to just add a custom anim curve to your default animation that you later use to drive the walk speed as detailed above. So it kinda is wasting time.

Adding a curve would take me 30seconds. Implementing it maybe a minute.

Getting root motion to play nice for one animation would take about 15. Assuming you can even get it to play nice…

By intercept, I mean that you can read what the animation intends to do to the character and prevent it from happening. Then, you can feel the data into your navigation agent to easily get a combination of navmesh movement and root motion. It looks like this (plus some logic in Update (equivalent of Tick) to update your animation params and smooth the turning):

void OnAnimatorMove()
{
_navAgent.velocity = _anim.deltaPosition / Time.deltaTime;
}

Anyway, you mentioned a root motion curve, and reading bone locations and directions. What functions do that? Something like GetMesh()->GetBoneLocation(an FName I assume?). Where do you get this root motion curve?

Edit: By adding a custom anim curve to your animations, do you mean a readonly curve that goes from 0-X, where X is the character’s displacement? How do you avoid having to spend 2 hours tweaking it by hand, ie, by eyeballing it if your character had a limp with uneven speeds?

Lastly, how do you just tell the agent to move while staying on the navmesh, eg, during a root motion attack montage or if they are pushed? What are the function names I need to know about?

A) yes, or get socket. They take bone names in. You can’t tell where they are going to be however, you have to make your own blueprint callable function for that.

  1. correct.

  2. you answered your self in 1. Its the displacement you animate the root bone, then take the data, move it to a custom curve, and remove it from the root bone.

  3. ai move to, and generally any ai related movement. Simple move to. Just type move into the editor when making a BP with context unchecked to see them all.
    Either way, for a combat thing you usually just add impulse. The collision will take care of the rest.

Thanks for the information!