Download

Importing animations with root motion from Blender into UE4

Hi y’all! Hope you’ve had a safe week.

I’m jumping to ask about the workflow for getting root motion from Blender into UE4. Last I checked, this wasn’t technically possible, but it’s been a while now and I’m hoping someone’s come up with a solution.

For those wondering what I’m on about: I’ve tried many times to import animations with root motion into UE4, but they invariably fail to work. That is, they fail to move the pawn being animated, as shown in the documentation.
https://docs.unrealengine.com/latest/INT/Engine/Animation/RootMotion/

Animations that merely rotate the pawn, however, seem to work. The problem is in the change of location.

Some people have suggested animating the pawn’s armature instead of its root bone, which I’ve tried, and I’ve also tried scaling those animations by a factor of 100, since I’ve seen it suggested that the issue lies in a size discrepancy between the two programs.

Still no luck. If anyone has successfully imported an animation with root motion from Blender into UE4, I’d be hugely grateful to hear about your workflow.

Thanks for your eyes, have a pleasant day.

It is very possible. You only need to animate the rig in object mode instead of pose mode to get animation on the “real” root bone (the armature object turns into your UE4 root bone)

A short step by step guide:

  1. Create an animation, root motion in object mode on the armature, the rest in pose mode as usual.

  2. Export the mesh and rig (or only the rig) as a .fbx file. You should have 0.01 scene size to get the correct size. You may need to resize everything after changing the scene size and also freeze the transformations by applying object transforms. Scale should be at 1 for everything.

  3. Import into UE4 with the animations. You can create a Third Person Template project to get a character that you can modify to see the results when you’re done.

  4. In the animation sequence enable root motion. You should see the character stuck in place. Also check that the root motion works by enabling Process Root Motion under Show in the 3d view.

  5. Create an animation blueprint for the character and enable root motion in Edit Defaults. For now set it to “everything”. Add your animation to the anim graph and hook it up to the result.

  6. You need a character for root motion, if you made a Third Person Template project you can click the mannequin and replace the mesh and animation blueprints and you should see your root motion animation play. Note that if you’ve got some jumping going on you will need to change the character movement settings to Flying to actually see the character float away from the ground. Normally it’s stuck to the ground.

I also made a silly .blend example that you can export and it should work. If you try it out you need to change the transforms so it lines up with the capsule.

Thank you for answering! So far no luck, though.

When you say “freeze the transformations by applying object transforms,” I’m not clear what you mean. I resized the mesh & armature and did that bit, which reset their scale to 1. When I import the animations into UE4, however, the mesh becomes contorted, shrunken onto the skeleton, making the character look like a stick figure. And when used for root motion, the animations increase in scale by 100 or so.

I wish I could check out the blend file you uploaded, but my tower has no internet connection right now.

You select the rig, do Apply Object Transform (search with spacebar) and select Scale in the bottom left. Then do the same for the mesh. They should both say Scale: 1 for x, y and z in the dimensions window. You may have to redo the animations because the transforms will get scaled as well. If the scale is at 1 and the scene units are meters with 0.01 unit scale you should be good to go.

I went and made a quick mesh and armature in the right size, made an animation and imported it, and root motion works. So, I guess that was my problem – my creations were too small.

I’d like to know how to fix the animations I’ve already made, though, if I can. I’ve been trying to follow along to what you’ve suggested, but it’s just not working for me yet. I must have missed a step – and now that I’ve saved my work, I can’t get back to my old setup. I didn’t keep any backups. If you have any idea how to retrieve old work, that would be great.

In the meantime, I’ll keep messing around and try to fix things. Thanks again for the help, it means a lot!

If you’re talking about the .blend files you can check the folder where you save them, if you’ve got versioning enabled (probably on by default) you should have a filename.blend1 file there. Maybe it’s gone if you saved it multiple times. I don’t really know how to fix the animations, maybe you could scale only the transforms in the graph editor by filtering the location keyframes and scaling everything by 100 or 0.01, I forgot which. If that doesn’t work you’ll have to redo the animations.

I noticed you had an issue a few years ago lol but im having the same exact issue with my character. My character work with root motion enabled he just keeps walking in place. Can you help im a new developer and still learning! Also are these instructions still up to date please help.

They are not. Now you can remove the extra bone from Blender by naming the rig “armature”, if you do that you can animate root motion in pose mode on the root bone itself.

After that open the animation, tick Enable Root Motion somewhere to the left, then in the Show options enable Process Root Motion. Now the character should move forward (or whatever it should do) and not reset every cycle. If not you messed up somewhere. :stuck_out_tongue:

Then put the animation in your character’s anim blueprint and change the settings there too, root motion from montages if using montages or root motion from everything if not. That’s it.

Hey, Im working with Donny_Stew on this project with him working on the Unreal side of things. Originally we had a character walking in place and used Axis Events to move him along. We noticed that it worked alright but say other walking animations that were so much more fluid using Root Motion in their animations instead. We already created a character with basic functions like walking, running, jumping and just started punching. While doing the punching animations we noticed he was punching in place instead of moving forward a little bit like the animation plays. So we took your advice and adjusted the “armature” in blender so it was 0,0,0 with no rotation like mentioned on the Unreal tutorials. We exported it as FBX and imported it in Unreal. It came with a new skeleton in the file. I tried to use the same bone mapping for a montage combo but nothing would show up due to the fact the skeleton is different. I ticked the Root Motion, Processed Root Motion and made it a montage. I just want to test it in game to see if it works. Is there a quick way to create a quick input to see if in game it moves with root motion? Also if the walking animation has root motion, do you use it as a Axis Event or an Action event? I appreciate all of the help. This is the only thing that is stopping us from further progressing, so any help would be amazing. I know this is a lot to throw at you, so thanks for your time reading this.

Update: We made alot of progress but as expected have hit a curve and we’re wondering if you had any insight. We have successfully made the character move with root motion only issue is the character moves outside of the capsule and then teleports back to it after the animation is finished we just need to fond out how to make him move with the capsule and we will be golden! Any assistance is much appreciated!

If the character teleports back the root motion isn’t really working, you should repeat the above method to see if it’s working in Persona. If it is you need to change the defaults in the anim BP, if you’re using montages for root motion find the setting for root motion in the anim BP details panel and set it to Root Motion from Montages, otherwise set it to Root Motion from everything.

If it’s not working in Persona you need to look at how you’re animating it, your hierarchy should have “root” at the top, root motion won’t work if you animate the root bone when there’s any extra bones on top. That’s why you need to name the rig “armature” in order to make UE4 remove the extra bone that’s not required (and messes up root motion).

Okay forgive me but im fairly new and some of the verbage your using is a bit unfarmiliar to me. We have in fact tried everything above but something i dont quite understand is what you mean by naming the rig “armature” so unreal can remove the extra bone.
Does unreal just know to remove the extra bone from the armature because its identified as armature?
The extra bone i have it “root” and its the one that moves everything… is that the extra bone you are refering to?
Also do i need to change the name of the rig to armature in UE4? Or change the name in blender? Or both?
Thanks for your time I see alot of people are hhaving tjis issue hopefully this will help them too.

You need to change the name of the rig object in Blender to “armature”. So the whole rig, not a single bone or anything. How are you animating your root motion in the first place? If you’ve got a real bone in the rig called “root” and animating that you need to make sure the extra bone you don’t need (this ends up being the name of the rig object in Blender usually) is removed on UE4 import, which is what happens when you name the rig object “armature”.

This is needed to make the root bone you’re animating the top bone in the hierarchy (look in Persona to see that) so root motion will work. Otherwise you would have a bone named MyCharacterRig (or whatever the Blender rig was named) which would take over the root bone’s job (root bone would be parented to the MyCharacterRig bone) and make root motion not do anything.

e5a3384f187bac67501fbf49b0d66ce5381d3000.jpeg

This is my current Hierarchy setup.
The entire build of all of the bones is named armature hopefully that is correct.
does anything look out of place? My root bone is at the base of my character that way when the character walks it uses that bone to move and to act as a reference point for the feet.
In the UE4 skeleton tree in the animation is the top bone supposed to be root or armature?
If there is another bone or somewhere else I need to change the name to “armature”, then where would that be in blender so I can do that?
Also, I don’t have any extra bones I just have all the limbs etc. and the root bone which moves everything is this the bone that UE4 needs to remove?

2fb48ef6bdc8945df8af549b011bf1e1781f7447.jpeg

In your case the “extra” bone getting removed is Armature (which is not really supposed to be a bone anyway). The top bone in UE4 should be Root. So how does it look in UE4? Also what UE4 version are you using? I think the Blender extra bone fix was added pretty recently.

In UE4 (v.4.15) its coming up as armature being the very top bone (like it shouldn’t). And in blender the top bone is root like it should be and there is no armature bone. Any idea whats wrong?

It seems like the fix was added in 4.16 so you should upgrade and see if it works there.

Thanks so much! We will give that a try!

Hey, so we installed Unreal Engine 4.16. I attempted to move the animation to 4.16 from 4.15. Once I did it gave me a lot of animation bone settings errors that were not eligible to edit. So I started a new third person template. Entered in the Action Movement, Mouse Movements and what not just as a base. Then I noticed the skeleton that was imported was at some crazy numbers as far as Local Location goes. It was x=0 y=0 z=0 in 4.15. So disregarding that I continued to input the animations the same way as before. Some animations would appear missing until I put in Root Motion. I noticed it wasnt invisible, but it was scaled to 1. Normally 1 is what it is at. The skeleton reference is at a scale of 100. Each animation is imported at the scale of 1, but when root motion would be turned on it would move to a scale of 100 to match the skeleton. Ive imported it a few times and tried to change the scaling, but no matter what it ends up that the skeleton is at the scale of 100. I tried to just change one animation’s values, and it messed up all of the other ones too.

So basically to sum it up, the scaling on import are off, the Local Locations are off, and the character will walk in place with root motion enabled in the Animation Sequences. In the Anim Blueprint I enable Root Motion from Everything. No luck ether. Ive imported over and over with small changes in Blender and it seems like it just made up its mind that it wants to overscale the skeleton on import. I assume this is what is causing the character to walk in place.

Side note, the left and right walking anims with root motion enabled would rotate as if it was walking forward and looking to the side. If you have experienced Root Motion on 4.16 I could really use your help. Once again thanks for all the help up to this point. Any import setting tips, scaling tips both in blender or UE would be much appreciate. Also if you have successfully had a character move in root motion on 4.16, would you mind sending it or linking it? Having something as reference could help a lot. Thank you.

It seems like you’re using default unit scale settings in Blender which messes things up. There’s a UE4 bug where scaling on skeletons messes up animations (see Animations from Blender using default settings don't work in UE4 - help fix the Blender FBX exporter - Feedback for Unreal Engine team - Unreal Engine Forums for more information).

It’s not too hard to fix though, in the Blender Scene settings under Units you can change Length to Metric and Unit Scale to 0.01. This will make your mesh tiny, so select the rig in object mode and scale it up by 100 times, then do Apply Transforms selecting scale on both the rig and the mesh. After that you will have to animate the root motion again because the animation will have turned tiny (like the result you were getting in UE4). After setting up the unit scale and making sure the rig/mesh are at 1.000/1.000/1.000 scale you can export again and see if it works, and it should. You should also replace (delete and reimport) the physics asset since the character with fixed unit scale will have way better ragdoll collision by default.