Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

AI Driven Locomotion with Root Motion

I want to replace my In Place animations to Root Motion for AI/Enemies. But when I do this, don't know how to handle AI movement.

Any idea for this implementation?

Product Version: Not Selected
more ▼

asked Dec 26 '14 at 12:33 PM in C++ Programming

avatar image

131 8 15 138

avatar image IronBoundManzer Jun 14 '16 at 04:23 AM

Has this feature been implemented yet ?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

it's so simple, make your AI Character look at Path Points instead of using Simple Move To Actor method, that way you will get use of AI Navigaiton for your AI Characters without forcing them to Move by their CharacterMovement Component, and then you will have the ability to move anywhere using root-motion method.

I made this simple blueprint, and my AI Character follows my Main Character without any intervention of CharacterMovement, only animation root-motion is driving my AI Characters ;) alt text as you can see, I have used Find Path to Location Synchronously to get the path point Number 1 as shown...

alt text

..then I made my AI Character Look At Path Point Number 1 - we only manipulate rotation here not the movement, therefore, we can make our AI move (or jump or punch or sing whatever you like) according to his root-motion animation separately. alt text now I could have him THINK like an AI but with root-motion movement. ;) he can find his path to the Main Character with a AI Navigation System Mind, but with root-motion movement. that's because we only manipulated his rotation. I hope this helps, and this is how I deal with my AI Characters, I never use CharacterMovement method for them.


  • you should make sure you get the path point number [1] from the array of Path Points, any other number will not get the desired result for your AI.

  • make sure the Filter Class in the function is set to RaycastFilter_UseDefaultArea option as shown in the first picture.

  • make sure you have generated your Navigation Mesh Bounds in the level or particularly.

message me if you have any questions further.

2.png (87.8 kB)
3.png (101.5 kB)
4.png (64.5 kB)
more ▼

answered Jun 25 '16 at 03:06 AM

avatar image

Omar Nader
23 5 6 10

avatar image Arturogalaxy Sep 08 '16 at 04:38 AM

Had same problem, I love you. It just works.

avatar image Jeka3d Oct 07 '16 at 02:46 AM

what about rvo avoidance? dont work for me if Ai use rootmotion

avatar image NawTCar Nov 04 '16 at 07:56 PM

Does the above approach adjust dynamically? For example, if anything about the environment changes, is there a function that notifies you to find a new path? Otherwise, it seems that you would just continue looping through the initial set of points found without adjusting for changes in the environment.

avatar image Bad_Request Feb 23 '17 at 11:25 AM

Thank you this solution is perfect. However I'm having problems with the rotation. If the AI needs to rotate like 90º or 180º it'll just snap into that rotation. I've been trying to get it to slow into it, but nothing seems to work. Tried changing the rotation speed in the character movement options, but didn't really think it would do anything, and it didn't. Tried using finterp to and rinterp to but did nothing or the AI just started walking away from my location, and rotated away from me. If i started going after it it would always keep its back to me, which was kinda funny. Any ideas on how to make the rotation smoother?!

alt text

bp.jpg (512.2 kB)
avatar image Bad_Request Feb 23 '17 at 01:18 PM

Apparently i managed to solve it. Here's a screen if anyone's getting the same issuealt text

bp_2.jpg (668.4 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

This is a very complicated matter :) To use root-motion animations for locomotion you'd need a dedicated solution for locomotion planning that would be taking a navigation path and was figuring out a combination of available animations that would more or less follow the path (or the next N segments of the path). UE4 doesn't have a subsystem like that, sorry.



more ▼

answered Dec 28 '14 at 10:20 PM

avatar image

MieszkoZ STAFF
7.3k 223 57 412

avatar image John Alcatraz May 26 '15 at 10:45 PM

Hi Mieszko, will root motion cause the AI to leave the navmesh or is the end of navmesh like a collision where root motion can't push the AI off?

avatar image dzeligman May 26 '15 at 11:04 PM

Root Motion just converts animation translation to velocity that is applied to the AI's character movement component. It will move them off the NavMesh.

avatar image MieszkoZ STAFF May 27 '15 at 09:23 AM

Dzeligman is correct, currently root motion doesn't care about navmesh at all. However this should be pretty easy to address - just add an extra step to actual movement that would clamp pawn's root component's translation to navmesh. I think UCharacterMovementComponent::PerformMovement should be a good starting point.

avatar image John Alcatraz Jun 05 '15 at 11:09 PM

Thanks for the answers! I only use blueprints. So we currently can't use rootmotion for AI at all in UE4(with blueprints)? How do all the other games handle this where all the AI uses root motion? As far as I know it's possible in Unity.

avatar image MieszkoZ STAFF Jun 08 '15 at 08:47 AM

Not out of the box, no. It's a missing feature you might say.

avatar image John Alcatraz Jun 24 '15 at 05:06 PM

Can I somehow simply clamp the character movement component location to be on the navmesh so that it just never can leave a navmesh, in blueprint?

avatar image MieszkoZ STAFF Jun 27 '15 at 09:59 AM

The only thing you can do in blueprints in this regard is every tick check if AI left navmesh, and if so teleport it back to the remembered last "good" position. This is a hack but should give you what you need. And I'll file a feature request so that character movement component would have an option for doing the clamping automatically.

avatar image IronBoundManzer Jun 14 '16 at 04:23 AM

Any other solution yet ?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

You should probably drive all standard locomotion animations/blendspaces normally, eg in place with velocity and direction fed into the blendspace. Root motion will be best used for one off animations such as hit reactions or attacks.

more ▼

answered Dec 28 '14 at 04:59 AM

avatar image

708 32 30 53

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question