EASILY Set up Root Motion with Mixamo Animations In Unreal Engine 4

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey there guys and welcome to my unreal engine tutorial on how to easily set up mix ammo root motion animations to the unreal engine 4 mannequin skeleton first off let's talk about root motion i would highly recommend that you guys take a look at the ue4 docs that discuss root motion and they discuss it incredibly well and explain everything perfectly using videos and images but basically root motion is the motion or movement of a character that is driven by the animation itself instead of a character controller the root bone specifically is what is actually being animated and as a result the collision capsule moves or rotates and i'll be showing you exactly why this is so useful so i downloaded some of the mixamo animations for those of you that haven't seen my previous my previous tutorial on how to re-import them and retarget them i would highly recommend you take a look at it as i will not be discussing any retargeting information at all the only thing i will be saying actually is when you do download them um here's an example if i just type one here ensure that the in place check checkbox here is false as you can see the character is moving forward that is exactly what you want you do not want any in-place animations otherwise you will not have any root motion data to play with and you you need to have remotion data obviously to have root motion animations so make sure that this is off this needs to be false and then you can do what you have to do with the download settings like i did in the previous video right so let's get started with ground route motion so as you can see here this is just your basic running animation except that he arcs to the right you can see that this is root motion in a variety of ways first off you can see that the starting location compared to the end of the location of the animation is different you can also go to character head over to bones and go to all hierarchy and you'll see a red line this is just the an indication that the root bone location is changing you can see he goes all the way there so let me just put this i'll leave it on for now the settings that you need for root motion to work in unreal engine um every single animation sequence needs to have enable root motion checked this right here in the root motion section of the animation secondly to further add accuracy to your root motion animation you're going to want to set the root motion root lock to anim first frame this just uses the root bone position of the first frame of the animation and i'll show you why this is important so if you go down here you'll see the character is still a little bit floating every time you enable root motion this is what happens he gets shot up a bit so we need to do is we need to enable that and then we need to set it to another first frame and then now he's brought back down to the location he's meant to be so as you can see here now the moment you enable root motion it suddenly feels like it's an in-place animation this can be quite confusing so if you would like to see what your root animation is doing you can always go to character animation and process root motion once that's checked it'll be going on a sort of infinite loop where the character will be completing the animation in loops so he's just continuously running and walking that direction but you can see again that the root is changing yeah it kind of loose back so what i would like to do is go into here and uncheck that if you would also like to see in terms of like the actual bones and how they move you can come here to skeleton tree and click the root and you you'll be able to see in the transform that the root bone is actually moving you can see here x and y mainly at the moment there is no change in the z-axis that this is why this is a ground group motion animation so you can see yeah it moves and that's how we know that this is definitely again confirming for the third time that this is a root motion animation if i go back to enable root motion we're now going to go into the next step of enabling root motion foreground uh ground root motion animations so if to go to the anim blueprint we have to go to class defaults which is actually here and we have to ensure that the root motion mode is set to root motion from everything this just ensures that the blueprint at the animation blueprint extracts every bit of root motion data from all animation sequences that have root motion enabled that's exactly what that does and it works very well what i'm going to do now is create a testing scenario just so you guys can have a much easier to test animations this way i find so i'm going to be doing it you guys can do it if you wish you have to i'd recommend it so you go to enter key and we're going to create an event where if you press a key it's going to trigger a boolean that is then read into the animation blueprint and then therefore triggers the animation so this is the basic is testing animation and then we have a flip-flop that alternates between two different variables so i'm going to put this here and i'm going to set it to when we press it once it's going to go into true and if i press it again it's going to go into false and it repeats i'm going to go back into my animation blueprint i am now going to get this in space here take the try get pawn on a node and pull off the reference and cast it to the third person character again this is for testing purposes this is why i'm not focusing much on neatness i'm just trying to create a testing scenario so we can easily test out and ensure that all the animations are working correctly so we're going to get that testing boolean that we just made i'm going to get it and we are going to promote it to a variable inside the animation blueprint is testing animation so now we have a direct link a direct reference to the boolean that is in the character blueprint and it's now connected to a variable that is in the animation blueprint and it's constantly reading that variable so it changes if it changes in the third person blueprint we will know in the third person animation blueprint so i'm creating and state where it's going to be like a testing state called testing animation the transition rule is going to be is testing animation true so it's going to move from idle to this particular animation if that variable is true and it's going to go back into idle once testing animation is not true those of you that don't know how to actually make notes straight you just select them press q it's a glorious tool i love it so we've got the transitions working now we need to actually place in the animation take this drag and drop it into there and we're going to keep it on loop just so you guys can see exactly what it does and that should be it so we take the character here if i press enter he will now on loop play the root motion animation this is the animation doing all the work i'm not touching my keyboard this is purely the animation doing all the movement for my character and that is how you do ground root motion animations so now that we've got that working we're now going to jump into the air root motion animations so if we take our root our rope climb animation as you can see it's coming up again you can tell us for root motion because the character is moving from its original position upwards it's quite a short animation um what we are going to do is do exactly what we did last time enable root motion we are going to set the anim instance the sorry the root motion root lock to anim first frame i'm going to save it and you're even going to see here i just disable that quickly just so you have an idea of what the animation is that again if you look at the transform it is moving left and right but most of us more specifically it is moving upwards you can see the z-axis change quite a bit and this is why this particular scenario is a little different to the previous one so again setting that all these settings to be true i'm going to just play the animation and show you what will happen if we don't input the correct things so as you can see here that's all good press enter see the character is moving left and right you can even see the capsule moving himself but you can't actually move up and that is because of the i think called a mode a movement mode and the current moving mode is walking so we have to change this when the animation is played why do they change that well each movement mode has its own set of physics functions that are responsible for calculating things like velocity acceleration and things like that which is why it won't work because things like gravity is being applied to it the character so to stop that we have to create a animation notify and that is here so you go to the animation that you would like you go to the notify section you right-click and you hit new notify right here we're going to call this notify what should we call something that's related to root motion so go start root motion air you can name it whatever you'd like i just feel like this makes sense because it's a root motion that's in the air and it's starting so we keep it there now be careful not to place it too early i've noticed that sometimes if you place it too early it just skips it so now that we've created the notifier we're going to go into the animation blueprint i'm going to go to the event graph and we are going to start root motion we're going to find the event this is the event that we just created in the animation and we are going to to actually change anything from the character we need a reference to it so what i'm going to do is i'm going to take this i'm actually going to right click on it and promote it to a variable we're going to call this character that way we can actually use it in any of our notifiers right here so we go here we get character movement and on the start we are actually going to set movement mode and we're going to be setting it to flying because that way no nothing like gravity will be applied to it the character can move up freely without any constraints so flying it is okay this definitely i think that is it for the error motion let's just check it out now is it being applied to it and yes the character is now moving up perfectly and it's actually quite a nice animation and you can see the z axis is changing everything is changing it's moving a little left and right every now and then and he's climbing up so the next step is going to be trying to figure out how to do air and ground root motion animations so here's an example of one sure idea this is just one where the character is running up and then jumping into a climb so as you can see he is moving in the ground remotion and at a certain point his z-axis begins changing and then again at a certain point the z-axis stops right there so we're gonna do what we always do enable root motion make it anim first frame save that i'm gonna show you exactly uh why we need to do what we're going to do again so run into a coin i'll start the right one run into a climb here okay let's see what we have to do so you see it it runs up of course the z-axis does not change but the forward route motion does so we're gonna use what we did last time i'm gonna create a notifier we're using the same one this is why it's so great to have these notifiers i'm going to go to skeleton notifier and we're going to start root motion air that's fantastic we're going to start it around when he leaves the ground like here probably is a good idea okay that should be it right we'll take a look here in the air and we're good oh it's on loop let me just actually stop that no we don't need to loop it's easy if it doesn't move so we go here do it again and bingo we're there but as you can see now we can't do anything it's fully stuck if we transition back we are now essentially moving and flying even if i let go of a directional key he still slides because we are sort of flying so we need to have an end root motion air so we have to go here probably around maybe here is when the room motion needs to end in regards to the z-axis change so we get a new animation notify we're going to call this end root motion air so that way there's a start and there's an end point so if i go back to the animation blueprint we go to end root motion air and the same exact thing except we're not setting it to flying we are setting it to walking which is the default uh land movement mode so to put a commenter on here this is going to go uh root motion air more like in there i guess technically but yeah okay so we gotta start we're gonna i think that's all we need so if we do this if i just move the character here onto this white block because i did prepare for this exact scenario didn't i i'm gonna rotate it like so and i hit enter he climbs up and he's finished and that's exactly what we wanted so great we got that done now let's move into turn-based animations now these are actually quite easy if you have the correct animation what i mean by that is if you have seen the mixed hammer animations there are a lot of animations that unfortunately don't have any rotation data with their tone animations as you can see here if you look at the transform the local rotation is not changing at all that is an issue and i'll show you exactly why if i set this to root motion so to set it to adam first frame as we have been doing this entire time and then we get that animation in here just an animation called mutant turn right it's not a big deal put that in if i rotate just once i'll turn off looping for example here i turn the actual capsule has not been rotated why do i know this because if i press enter again and return back to my idle state he will face the direction that he is originally at because the animation itself is not turning the character it is incredibly annoying and disappointing but unfortunately terrible studios i did end up contacting them and they said that they are not going to be fixing this for a while they're doing other projects and therefore do not have the time to so i will be showing you an example of what correct uh root bone rotation would look like using an animation that is actually from another content creator his name is metal design and he i have this animation it's from one of his series i think it's called ue4 climb system and just a ledge climbing system tutorial which is super awesome check it out in the link description below and why this is a good example is because the actual root bone does rotate and here's an example of it so that this animation is just a ledge climbing he rotates around the corner so we go here and you can see the character z you can see here it starts turning it starts rotating the character and that successfully rotates the character and i'll show you why it's so good for us once i change the settings back to where it's supposed to be the root motion enable it and then first frame go here drop that into the animation blueprint drag that drop there and when we use it right here does that oh it's looping apologies it is not meant to loop i thought i changed that so go here loops and then hit enter again and now the character is facing the correct direction that he just rotated to because it rotated the root bone not just the mesh and now we're here yeah and that is how you set up root motion using mix hammer animations under several different scenarios thank you very much guys i hope this was useful and good luck and have fun
Info
Channel: CARD00R
Views: 25,321
Rating: undefined out of 5
Keywords: Unreal Engine, Mixamo Animations, UE4, Mixamo to Unreal Engine, Mixamo to UE4, mixamo to unreal engine 4, Mixamo Animations to UE4, Mixamo Animations to Unreal Engine, Mixamo animations Unreal engine, Mixamo animations UE4, Root Motion, Root Motion Animations, Mixamo Root Motion Animation, Ue4 Root Motion, Unreal Engine 4 Root Motion
Id: D3SYHDJEq9g
Channel Id: undefined
Length: 17min 57sec (1077 seconds)
Published: Sun Dec 27 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.