How To Make An Animation Blueprint In Unreal Engine 5 | How To Animate A Character - UE5 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys and welcome back to another unrelenting tutorial today is actually my first imagine five tutorial i believe and what we're going to be going over is how to create an animation blueprint and blend space in unreal engine 5 for your own character so in this i'm not going to be going over importing the character and the animations however i do have a separate video which i did do that previously on it was in on version 4 but the process hasn't changed at all so you can use that one nothing else is different because the main part is outside of unreal however if you do want me to make an updated video for management 5 just let me know in the comments down below and i can definitely make that for you if you want without further ado let me actually show you what we're going to go over and create today you probably know what it is it's basically we have our own custom character and we have animated it here so what we've got is our right animation going into a walking animation and a running animation as well as a jump too and the jump can be moving and standing still like this now you might notice my character is controlling a little bit differently the speeds are probably different to what you're used to as well as the jump height too so i've just changed those to fit these animations better just to make it look a little bit nicer and more realistic as well i just like to do that whenever i make a game and i can show you the settings i have as well so you can have it looking just like this too and the character i'm using is the erica archer off of mixedmode.com which i'll leave a link to in the description down below and i'm just using some basic animations from there too but that's enough talking so without further ado let me just leave this code and i'll show you how i've done it so what we're going to do first is we also want to create our animation blueprint so we can hold all of our animations for our character so what the animation blueprint does is it just allows the character to choose which animations it needs to play based on certain specific values which that's more of the state machine but the animation blueprint holds all of it so to do that what we need to do first obviously hold control and press space to bring up our content browser here and then we just need to find where we want to do it so i've got a content folder inside that i've got erica which is the name of my character then i've got an animation folder in there with my animations here and this is where i'm going to create it so i'm going to right click go to animation get an animation blueprint choose a skeleton you have so again for me that's erica archer skeleton press okay and then what i'm going to do is name this to be erika and him bp as that makes no sense for me and i'm going to open it up straight away now in here you should be greeted with an output pose on the anim graph again this here decides which animation is going to be playing on our skeleton so on our character so to determine what animation we want to play we want to use a state machine so drag out a result and add a state machine and i'm going to click on it just to rename this to locomotion as that makes no sense for me i'm not sure why they have white text on a white background makes it difficult to see for example i didn't know i swear wrong but hopefully they change that in the new version it says open up our state machine here now i'm going to do a very basic state machine because all we need to do is have our idle walk run and jump and we can do that in two different states so i'm going to drag out of entry add a state and i'm going to name this one idle slash walk slash run because we can have all three of those different animations in one state because we can have it inside of one animation blend space as that blends between different animations so i'm going to drag out of this again at another state and now i'm going to add a jump one and from jump is going to go back into the eye walk run as well so it goes between the two so we can go from idle walk or run into a jump and back from my jump into the idle walk run like this we're gonna double click our jump state here and just drag in our jumping animation so when we are inside of the jump state it's going to be playing this jumping animation here what i personally also want to do is untick loop animation here now you don't have to do that if you don't want to but again for my animations and my character i personally think that one looks better but you can obviously do whatever you want what you can even do is maybe create a jump loop which i do have a separate video on as well but again i can create an updated one for our engine 5 if you wanted to we're going to compile and save that and go back to our locomotion state so now here we don't have the animations for eyewalk run yet and we don't have anything to go between the two states here so if we double click the little arrows from either walk run to jump you'll see we have a result can enter transition we want to enter this transition if we are jumping so to be able to know when we're jumping we can go to the event graph here and you should have event blueprint update animation and try get pawn owner if we drag out of try get pawn owner what we can do is we can get the movement component of the pawn owner of the animation blueprint so whichever pawn owns the animation blueprint is going to get their movement component out of the return value we can get actually don't type get but what we're going to do is get is falling and this is going to tell the animation blueprint if the player is falling or not so we're going to be using this for jumping so this obviously also does the same thing if the player just walks off an edge this will play the same animation which you might want you might not want if you don't want that then what you should probably do is see if the player press space and they're falling then that obviously makes sense for you to do i'm going to right click the return value promote it to a variable and just name this jumping or actually i'll name it is jumping like so i'm gonna connect that into the event blueprint update animation so when the is falling is true jumping is true and when it's false jumping is false we also want the speed so the speed is going to determine which animation we are in in the idle walk run through our blend space so what we do is back in the event graph come out of the get movement component and we're going to get the velocity velocity is obviously the speed of the player but you see that this is actually a vector and we don't want it as a vector we want it as a float so we're going to drag out a velocity and just get the vector length like so this now turns into a float because it returns the length of the vector obviously as it sounds in the name and we're going to right click that promote it to a variable naming this one speed and again just connect this in so it's going to be set like so because again you need to make sure that all of the white execution pins are connected otherwise it will not be fired off and then will not be set so we can compile and save that and that is now this part all set up for actually determining the values to be able to blend between our animations so we've got is jumping and speed obviously as you grow your character and grow your animations you'll have more code in here for more different things you need to determine but with the basic thing we're doing today this is good let's go back to our state machine and we're going to click the arrow going from either walk run to jump so click the double little transitional rule here in here what we're going to do is just get is jumping the boolean we just made and we can connect it straight into the result there because what's going to happen is if jumping is true then we can enter the transition and if it's false then we can't and also we only want to enter the transition going to jump if we are jumping let's go back to the state machine and go from jump to idle walk run this one's gonna be slightly different it's going to be get is jumping but this time instead of just connecting it straight in we're going to get a not boolean so if is jumping is not true then we can enter the transition and if it is true then we can't enter the transition so i hope that makes sense so again if we're not jumping then we're not going to be in the jump animation and if we are jumping then this is obviously going to be false because true not is just the opposite of it which means it's false which means we can't enter it so we're not jumping says compile save that go back to the state machine and now if we double click our state of idle walk run you see we need to actually put our animations in here so again what we have is we have our idle we have our walk and we have our run animations however we can't just put these all in here at the same time what we could do is we could use a blend poses by int or anything along those lines however obviously we don't want that we can use a blend space which is a lot more efficient so let's minimize this control tab to open my content browser and back in my animations folder this is where i'm going to create it i'm going to right click go to animation and create an anim blend space or just blend space sorry 1d and you can make just a blend space but that is if you're using directional movement so if you're going to be going forwards backwards left right diagonal stuff like that i don't want that for the moment i just want 1d so this is going to be forwards done backwards so i'm going to create a blend space 1d on my erica archer skeleton and i'm going to name this erica bs for blend space not anything else and we'll open that up now in here this might look a bit complicated to start with but it is very simple so this little rectangle at the bottom here this is actually the graph determining what the speed is and what animation it should play so if you hold down left shift and move your mouse you'll see we're moving this kind of green cursor here and that's just going to be previewing the animation so on the horizontal axis under axis settings here i'm going to change the speed i'm going to change the name sorry to be speed the minimum value i'm going to leave is zero the maximum i'm going to put a 600 as it is the maximum marking or movement speed for my player again i'll show you in a minute how to set that bar up but just the maximum speed you want to go but it's that number of divisions you can keep as four or you can change it to three but i'm going to keep it as four and we don't need to change anything else then we're going to drag in our animations so all the way on the left when the speed is zero they're not moving so i want to play the idle animation as you can see here in the middle when the speed is 300 i want the player to be walking and on the right when the speed is 600 i want the player to be running so again if i hold left shift we can preview this so on the left they're idle as we increase our speed they're going to stop walking and as we increase our speed further they're then going to start running as you can see here now we'll see as you go in between them like this you get that kind of look there but that's fine for me because my speed isn't going to be 150 or 450 it's just going to be either 0 300 or 600 based on the way i've coded my character and yours should be the same as well if we scroll down the left we're going to find is the sample interpolation and we have the global interpolation here this is kind of the smoothness between blending from these different animations i'm going to set this to be 10 anywhere really between 5 and 15 is a good value so 10 is right in the middle is good for me obviously mess about it to get it perfect for you because it will look different for different animations so this is kind of just trial and error what looks the best and again this blends between animations so it's not just a dead-on straight and sharp transition from idle straight to running because that doesn't look too good you want it to be nice and smooth so let's save and close the blend space and we can now just drag in this blend space into our output animation pose inside of our idle walk run state here now the speed we get we create this earlier we're just going to input our speed float which we made like so and again this speed of the player is now going to determine which animation we're playing based on the horizontal axis value we just made if we compile save close this this should be now all completely done however you'll notice my character is still under t pose so let me show you how to fix that control tab to open the content browser and let's now find our actual character so for me that's gonna be content third person bp blueprints third person character what i'm also to do is just move this into my erica folder like so and i'm also going to rename it so select it f2 and i'm going to name it erica vp open that up like so now in here if we go to the viewport you see i have my character here yours might not be this yours might actually still be the default mannequin like this if it is just select the mesh then select skeletal mesh change it to your mesh that you want so for me that's the erika archer then under animation we have animation mode use animation blueprint and the anim class wants to be our erica and in bp which we created earlier so we'll compile save that you'll see it's now doing the idle animation as it's not moving so that is perfect if we go to our event graph what we can do is you see this is my basic sprinting code so when i press left shift it's going to go up to 600 when i release it will go to 300 i do have more in-depth videos on creating sprinting and stamina and all that good stuff if you want and let me also show you my default values so my default value for the max walk speed is 300 so by default the player is walking at a speed of 300 my jump velocity i've also put as 300 or a jump zed velocity sorry it's 300 and that's just lowered the height of my jump so those are the values which i've got which i think look a bit better more realistic and they definitely work better with these specific animations i've got as well but if we close this we can hit play and test this out you should see this is working perfectly so we've got our idle animation here looking like this we can walk and we can sprint and it all looks good like this sorry if it looks a bit laggy this version of um5 is still not very well optimized and obviously my pc isn't amazing but it still works so again we've got idle we've got walk and we've got run and they're nicely blending between each other as well and then we'll show you jump so jump from standing and jump from running like this so i think that'll be it for this video as we've done everything we want to do we've set up so we've animated our own character now so we've got our custom character in the game we've got it animated with an idol a walk and a run as well as a jump which works in both movement and standing still too so thanks so much for watching i hope you enjoyed and i hope you found it helpful and if you did please like subscribe down below so thanks for watching and i'll see in the next one [Music] you
Info
Channel: Matt Aspland
Views: 178,038
Rating: undefined out of 5
Keywords: ue4, unreal engine 5, unreal engine, tutorial, ue5 tutorial, unreal engine 5 tutorial, how to make a game, how to, 3d modelling, blender, games design, ue5, animation, animations, blueprint, blendspace, idle, walk, run, jump, how to make, animation blueprint, ue5 animation, anim, anim bp, bp, bs, anim bs, smooth, transition, make, ue5 animation blueprint, run animations, walk to run, idle to walk, idle to, walk to, jump to, to, from, back, dynamic, speed, velocity, direction, updated, loop, moving
Id: TE-SsP3pigs
Channel Id: undefined
Length: 13min 55sec (835 seconds)
Published: Sun Jan 09 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.