Using Mixamo Root Motion Animations in Unreal Engine 5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello and welcome to this tutorial on root motion animations i'm going to show you how to get animations from mixamo that actually move the character's root component and how to set this up so that we can use these in unreal engine we're going to be converting these meshes into meshes that have root bones using a blender add-on so the process will be nice and quick and easy so let's get started this video is made possible by the following patrons i'd like to give a shout out to new patrons andrew dashya yang risky tim jerry walker beacon george comby daniel williams and b welcome aboard and thank you all for your support and if you'd like early access to my new unreal engine 5 c plus course the ultimate game developer course you can access that from patreon as well and you can learn how to create an action rpg style open world game complete with dark souls or eldon ring style combat mechanics experience points in the form of souls gold and treasure breakable objects multiple types of enemies and you'll learn all about unreal engines new features such as open world animation blueprint templates linked animagraphs meta sounds root motion animations with motion warping advanced combat mechanics multiple weapons equipping and unequipping and will create our own visual effects in niagara so tons of new content if you'd like to start this course now before it's even released on udemy join my patreon and you'll get access to the videos as i finish uploading them so i've created a brand new unreal engine 5 project and it's got me open to this open world level so really nothing in here just an empty content folder and i'm going to need a character mesh and a couple of animations so i've logged into mixamo and i'm just going to download one of these meshes this particular palette paladin mesh has a sword and shield so i'm just going to pick this one there are two versions i'm getting the one with prop and that's the sword and shield there included in the skeletal mesh so i'm going to go ahead and download this and leave it as fbx binary in the t pose so let's download that and i'm going to need an animation so i'm going to go to the animations and search for idle and just find an idle animation to use so here's one this will work just fine so i'm going to download this and i'm going to get it without scan so downloading an idle and i'd like a root motion animation one that actually moves the mesh of the character so i'm going to search for attack so here's one that actually moves the mesh of the character i'll go ahead and pick this one so i'm going to download that without skin selecting download now i'm going to show you what happens if we get one of those root motion animations and try to use it here in unreal engine so i'm just going to make a basic character i'll stick it right here in the content folder so i'm going to make a new blueprint based on the character class i'm going to call this bp paladin and i'm going to need a mesh for this so let's get that mesh and those animations in here so here's my downloads folder and here's my paladin with prop i'm just going to drag it in here and i'm going to leave all of these settings as is and click import all now i get the no smoothing group warning i can close that it's not a big deal and here are the files now to keep this organized i can make a new folder called paladin and move all these new files into it and in paladin i can move all the materials to their respective folder so new folder i'm going to call it materials and move the material and its textures into that new folder and i now have this paladin skeletal mesh and if i open it it looks good but notice it doesn't have a root bone it has a hips bone at the top of the hierarchy and it's right here in the center of the mesh and this is why we can't use root motion animations i'm going to show you what happens if we try to use the animation that actually moves the mesh let's get those animations in here so in my palette and folder i'll go ahead and make a new folder called animations and i'll open that and i'm going to bring my two animations in the sword and shield attack and sword and shield idle i'm just going to drag them in and i can select my palette and skeleton here for the skeleton and import all now opening these animations my idol should be fine it just stands there it's not actually moving the mesh but if i take a look at the sword and shield attack i see that it actually is moving my character specifically it's moving that hips bone now because there is no root bone i can't use root motion i can go down to the root motion section and check enable root motion and then i see all kinds of problems the character doesn't look right it's kind of locked to the location of the hips bone and this is going to look really funny if we try to use it so let's see what happens if we try to use it here in the animations folder i'll make a basic animation blueprint so right click animation animation blueprint and i'll select my palette and skeleton and click create and call this abp paladin now opening this i can have the most basic animation blueprint possible i'm just going to drag in my idle animation and create a slot here so drag off type slot and get that default slot and this will allow me to play an animation montage using the default slot and i'm going to make a basic animation montage so i'm going to compile and save this and right click go to animation animation montage choosing my paladin skeleton and i'll call this am attack for animation montage attack now i'm going to open this and drag in my sword and shield attack right there and if i play this i'll see that it's moving my character's mesh and then the character goes back to the initial position so let's see what happens when we play this montage so i'll go to my paladin blueprint back in my palette and folder in fact it's out in my content folder but i'll move it into palette in here and in my bp paladin i can select a mesh so for the skeletal mesh i'll choose my paladin with prop and rotate it by 90 degrees and move it down and with my mesh selected i can choose my animation blueprint for the anim class abp paladin so now it's in the idle pose now i'd like to play that montage and i can just go to my event graph here right click and type left mouse button and with this node whenever i click my left mouse button i can do something such as play a montage so to play a montage i need to get my mesh and from the mesh i can get the anim instance so i'm going to type anime instance and use getanim instance here and from this i can play a montage so dragging off of this i'm going to type montage play get a node for that hook it up to pressed and for montage to play i'm just going to choose my am attack so we should just see our attack montage played so let's see how this works so here in this open world map if i go to world settings i see there's no game mode override so i can simply drag in my palette in here and select it and in the details panel go to auto possess player and change that to player 0 so that i can possess this by default now i don't have a camera or spring arm so i can go ahead and just quickly add a camera and spring arm to my character so selecting the capsule i'm going to add a spring arm component and with the spring arm selected i'll add a camera now that we have a camera i can come back press play and there's my character and if i left click i'm playing that montage and then i come right back to my initial location and if i hit tilde and enter the console command show collision i see my capsule and if i left click the capsule stays behind that's why my mesh comes right back to the capsule's location the animation is not using root motion it's not going to change my capsule's position it's just going to play the animation and bring that mesh back so for that reason we need to be able to use root motion now for an animation that can use root motion we would go into the animation itself here's my sword and shield attack and check enable root motion here but because there's no root bone in this skeleton this isn't going to work if i press play you'll see that we're trying to use root motion and things are out of whack right we end up with a strange role for our camera and even though the capsule is moving things are getting worse and worse as we play the animation so to properly use root motion we need a root bone so that brings us to a handy plugin for blender that we can use to add a root bone to our miximo skeletons so here's the plugin a link will be in the description for this video you just need to go to this link there are some instructions but i'll show you how to use it you're going to click the green drop down that says code and download this as a zip file once you download it you should have it in your downloads folder now you don't even need to extract this just leave it as a zip file and then you're going to open blender now blender is free and if you don't have it i'll have a link in the description for downloading blender as well it's a very small lightweight program and extremely powerful now you can click on the splash screen to get rid of it we can get rid of all the objects in the world there are three of them by left clicking and dragging to box select them and hitting the delete key now we need to enable the blender add-on by going to edit and preferences now here in preferences we can select add-ons and if you click on install you can choose a location where you have your miximo add-on so if it's in your downloads folder you're going to choose that zip file and click install add-on now as soon as you've done that you should be able to search here for miximo and check the checkbox to enable your miximo converter add-on once you've done that you can close that blender preferences window and up here to the right there's a little arrow to expand this side menu also the n key will show and hide it and you should see your miximo tab here this is that miximo add-on now the way this works is you have an input path and an output path and you select folders that you have on your machine for these so here's my unreal engine project there's all the associated files just outside of that i'm going to make two folders an input and an output path for this conversion process so i'm going to right click make a new folder and call this input path and i'll make another folder called output path now the input path is going to have the animation assets that we want to convert into animations that have a root bone so here in the input path we're going to drag in those new assets we've downloaded so here's my downloads folder again i'm going to go ahead and select my skeletal mesh and my two animations and i'm going to drag them into input path now they exist here and i just need to set these paths up here in blender for my add-on so for input path i'm going to click the folder and find my project file here it is i'm going to select my input path and click accept and then for the output path i'm going to find my project again and select that output path and click accept now before we convert these things there's just a couple of settings that i like to set on this to make it work better for one i like to unselect transfer rotation make sure that's gray and not blue and then i click on the advanced options and right here this checkbox for apply rotation i like to uncheck that i get the best results with that unchecked and then i click batch convert now once it's done it'll turn gray again just like that and now i can look in my output path and see that i have these files here so now i need to get these into my unreal engine project now i already have these assets here for my skeletal mesh that has no root bone i'm going to make a new folder just next to my paladin and i'm going to call this paladin underscore root bone and i'm going to open that up and get in my paladin skeletal mesh first so i'll drag that in and click import all and it didn't import my material but that's okay because i can double click my paladin and select the material but before i do notice it now has a root bone and it's right there between the two feet and the hips bone is attached to the root bone now we can use root motion animations with this skeletal mesh now for the material let's go to asset details and here's the material assigned i'm going to go ahead and expand that drop down and select the other material that i had when i first imported the skeletal mesh so now we have a material and this skeleton has a root bone and we can also get those converted animations in here as well so i don't need this white palleted material i'll go ahead and delete that and i'll make a new folder here called animations and open that and get my two animations in here attack and idle now for these i need to select my skeleton that has a root bone that's this one if i hover over it it shows the path and it's in my palate and root bone folder i have to select this skeleton not the one that does not have a root bone so my new skeleton now i can uncheck import mesh as i don't need a mesh for this and click import all and here are my two new animations i have my idle using my skeleton with a root bone and i have my sword and shield attack now this one can use root motion if i go to asset details and scroll down to the root motion section if i check enable root motion notice that my character stops moving forward this is what we want to see when we check enable root motion and notice it still looks natural it isn't locked to the hips bone everything looks correct it's just not moving forward like it does when we uncheck enable root motion so this means we can use root motion now now to use root motion in a montage we have to create a new montage and add this new animation to it as we have a completely different skeleton here so here in my animations folder in paladin root bone i'm going to make a new animation montage choosing my new skeleton the one with the root bone and i'll call this rm for root motion underscore attack and i'll go ahead and double click this and add in my sword and shield attack animation here and i can make sure that root motion is enabled for this sword and shield attack and i see that it is if i double click on it so now we have a montage using root motion so now that i have the skeletal mesh and associated animations that i want to use i'm going to rename the old ones so i know which ones are which so i'll go into my palette and folder and rename this skeletal mesh to paladin underscore no root and for the physics asset i'm going to call it pa underscore paladin no root and for the skeleton i'll call this sk underscore paladin no root now the materials are all materials that i'm now using with my new paladin so i'm going to drag that into palette and root bone and click move here and i'd now like to use my paladin with the root bone for my character blueprint so i'm going to move my character into palette and root bone as well and now i can rename this old folder paladin no root so my palette and root bone is what i want to use now so i'm going to open my bp palette in here and change the mesh to my new one the one with the root so i'm going to select the skeletal mesh and choose my new paladin and i need a new animation blueprint specifically for this skeleton so we'll go ahead and make one here so i'll go ahead and right click make an animation blueprint and this time select my skeleton that has the root bone i'll click create and call this abp underscore paladin and i'll go ahead and go into my palette in no root and rename this one to abp paladin no root that way we know which one is which and in my character blueprint i can select the animation blueprint abp paladin now this one's empty so i need to add some things to it so i'm going to close out of these old assets and go into my new animation blueprint which by the way i can stick in my animations folder so let's open that and for this one i'm going to use my idle animation this is the one using a root bone and i can add that slot so adding the default slot node now we can play a montage and back in my character blueprint in the event graph i now need to select my root motion attack so selecting that i can compile and save and now i can give this a test run so i see that i'm idling and if i left click i'm now using my root motion attack animation and it's working properly and i can show collision with the show collision console command here's my capsule and i see that it's moving along with me now one more thing to take note of if we look at the original animation this character kind of jumps higher into the air than we're seeing here we can go back and take a look at it sword and shield attack and if i uncheck enable root motion i see that he's kind of jumping higher so how come we're not getting that elevation well the elevation is taken out when we're using root motion but we can get it back as long as the character is in flying mode when playing the animation if the character is in flying mode then its z location will not be restricted as we're seeing so we can enable flying mode with some anim notifies let's go to our root motion attack montage and right at the beginning i'm going to add a new anim notify so right click add notify new notify and i'm going to call this enable flying mode and i'll make a new notify at the very end add notify new notify and call this disable flying mode now what do i mean by flying mode well if we go to our bp paladin and select our character movement component and search for movement mode we'll see that default land movement mode is walking and if we change this to say flying then our character will no longer have gravity applied i can take my character and bring it up into the air and press play and i'll see that i'm sort of hovering here now we don't have movement input but if i were adding movement input he would be flying throughout the world now we don't want this on permanently we just want flying mode while we're playing that root motion animation so now that we have these notifies let's click up here on the animation blueprint icon and in the event graph for our animation blueprint we'll use those notifies so we have enable flying mode and disable fly mode now to enable and disable flying mode we're going to need our character movement component so i'm just going to get that at the beginning with blueprint initialize animation and i'll use try get pawn owner here i'll simply take this cast to bp paladin and from bp paladin we're going to get the character movement component so get character movement scrolling down to the bottom there it is and i'll promote this to a variable it can be called character movement that's fine and in our notifies we'll get our character movement right click convert this to a validated get so we only use it if it's valid and with character movement we're going to call set movement mode and for enable flying mode we're going to change movement mode to flying and for disable flying mode we're going to copy these nodes and set the movement mode back to walking here and compile and save so now we'll have flying mode enabled while we're playing this animation and we do need to go back to the animation itself and make sure that enable root motion is checked now we can go ahead and press play and if we left click now we're flying up in the air at the same height as the animation itself and we can show collision as well and see our capsule moving so that's how we can properly use root motion in our animations as long as our character has a root bone so that blender plugin is really useful because we can batch convert multiple animations at the same time and as long as one of these fbx's has the skin the mesh with the skeleton then the animations themselves don't really need skin so when we download it from miximo we can choose without skin as long as one of these fbx's does have the skeletal mesh and the skeleton inside of it so that's going to conclude this video i hope you enjoyed it if you did please like subscribe and hit the bell for notifications and if you'd like the project files go ahead and join my patreon and you'll get this project file with these converted meshes and animations and if you'd like early access to the unreal engine 5 ultimate game developer course you can join patreon and get access to that as well so thank you all for watching i hope you enjoyed it and i'll see you next time
Info
Channel: Druid Mechanics
Views: 26,132
Rating: undefined out of 5
Keywords:
Id: f32fzAuJyZU
Channel Id: undefined
Length: 23min 2sec (1382 seconds)
Published: Wed Jul 06 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.