UE4 Basic Blend Space / Walk, Run, Idle, Jump

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back to another animation video uh if you haven't watched the previous episodes make sure to check them down in the description box down below there's some very basic information theory about animations uh what you need how the characters should be set up well somewhat at least the theory stuff of it and the basic knowledge that you should have before running these things and also in the previous episode we talked about the animation states and their replication so that might be interesting as well today we're going to be talking about how to set up the basic blend spaces so that our character can actually run around walk around and well basically we are going to recreate what the unreal engine skeletal already has and the mannequin already has by default and that is well we need to make sure that our character can blend between idling walking and running and also jumping states so first let's talk about the idle run idle walk run so for that we need a blend space which will allow us to blend between between these animations so i'm going to right click in the content browser go to the animations and create myself a new blend space and make sure to base this off of your skeletal i'm using this fit male 1 skeletal and i'm going to call this male blend space there we go let's open this one up and on the left side you might have the skeletal tree open go ahead open your asset details if they're not there they should be under the window and acid details enable this and it should pop up somewhere on the screen so um we have our horizontal axis and we have our vertical axis for the horizontal axis we're going to leave these b we're going to talk about these later because this is for the directional movement and we're going to talk we're going to cover that in the upcoming episodes as well but for today we're going to talk about the vertical axis so this line right here the middle piece that we have with this green square so let's name this our speed because this does represent the speed of our character now the minimum value needs to be zero that is our idle state and the maximum value well by default in unreal engine it is 600 and i'm gonna be using that value for this video now the first thing that we need is our breeding idol well mine and for me at least it's reading idle animation so your idle animation goes at the middle right here at the very very bottom and as soon as we drag it in you can see our character is idling now if you bring in the wrong animation or put it in the wrong position you can always select it move it around and once it's orange you can hit the delete key and it's going to go away so i'm going to bring this back in and there we go so uh the next one is our running and walking animation so i'm going to grab my walking animation and bring it to 150 and that's that is a pretty good speed for me for my animation now if your animation does not really match up maybe you want it to be ran at a different speed value but as you can see it is snapping to these you only have 150 and then instantly 350 maybe you want to have it at 200 or 250 you can always go ahead and adjust the grid size so in our case it is four you can bump this up to like five eight eight or whatever you can i think you can go like 100 as well okay so go ahead and adjust those values for your liking another option is to changing the speed of the animation itself so you can always double click your animation and change the rate scale and that is the speed of the animation so 0.5 is going to be half speed 2 is going to be double the speed of the animation so that's that's that might come in very handy always you can also go minus 1 and it's going to reverse the animation by the way so that's a handy thing to have okay so that's good let's go back to our blend space let's provide our running animation and let's try to make this functioning so if we move our green square right here you'll see how it blends between the states based on the characters speed as you can see so we are all good with our blend space we can go ahead and close it we're not going to touch it for at least in this video let's go now to our animation blueprint and you will see that if you watch the previous videos i have removed pretty much everything from this all i have is my default state and that's that's all that i have over here so uh what i'm gonna do is actually i cast to my character and then i'm going to go ahead and promote my character to a variable so that it is a little bit easier to access this so i'm going to call this player and there is one more thing that i'm actually going to do is i'm going to grab my player i'm going to get it and i'm going to right click this and i'm going to select convert to validated get and i'm going to plug this in now what this essentially does is this is like an is valid node it checks whether the player variable is is valid so whether it is set already now if it's not set we want to go ahead and cast to the character and we want to set it like so now if it is valid we are all good we can i'm going to add a reroute and i'm going to go directly past it and also after we if it's not valid and we set it we also want to proceed with this one because then our character our player's reference is already valid and we can go ahead and proceed with the task now uh well now we need to make sure our blend space actually works and it requires us to have a speed value and to get the speed value we can get our player from our player we can get its velocity and from the velocity we can go ahead and do the vector length so what this essentially does is velocity returns us the movement in x y z axis positive or negative and how how quick it is and then this vector length basically converts that into a single number which is a speed value which we can then promote to a variable and call this speed let's plug that in to our execution route and now this is going to grab us our speed we're going to come back to this in a second because we're going to need to get some more stuff for our jumping but first let's get our blend space functioning so let's go to our state machine so we have our state machine inside of here we have one default state we're gonna open that and we're gonna delete our idle animation from the previous video and bring in our blend space instead let's plug that in and let's provide this some speed once we compile and save this we can go inside of our game hit play and we can see how our character is now running now to test some more stuff let's go ahead let's make sure that we can actually walk as well so that we can reduce our speed so you can always go to your character movement and reduce your max walk speed over here i'm going to leave it b instead i'm going to have a left shift key event on which i'm going to grab my character movement and i'm going to set the max walk speed so on pressed and also we're going to change it on released as well so that while we hold it when we have it holding when we are pressing this it's going to be 150 and whenever we release it we go back to 600 also make sure to always connect the target as well for the bottom one and we should be good to go so now we should be able to hit play so we are running and when we hold shift we now are walking okay so our uh running and walking seems to be just fine now let's go ahead and let's make sure that we can actually jump because at this point well if we jump he starts walking because he has some velocity he has some speed so he is walking around so let's first we need to make sure and figure out whether our character is actually jumping or not and to do so let's go back to our event graph and from our player let's go ahead and let's check is falling and this is going to return us the character movement and is falling note which will tell us whether the character is falling and then we can go ahead and promote this to a variable and call this is falling and this is going to allow us to help figure out when we need to play our jumping animation so let's go back to our state machine and from here well now we need to set up a couple of states so we're going to drag from this we're going to add a state and i'm going to call this jump up and we are going to need a couple of animations so you're going to see that in a second because we will need a like in initiating the jump during the jump and then after we have when we are landing essentially so we will need three animations so if you have one which has all three of those things then you will need to copy and paste it three times and chop it into pieces and that's actually what i did with this one so we need another one another state from the jumping up then we need to go into a jumping jump loop which is whenever we are in the air and then we need another one which is the jump down which is when we actually land and then from there we can go back to our default state now at this point now we need to provide all of these conditions right here but before we do that let's go ahead and let's put in the animation so i'm going to double click jump up and let's have a look where i have mine which are i have my jump up to this one right here so you can see this is what it looks like so he's jumping up then we have the jumping loop like this one and then we have jumping down this one okay so back in the state machine jump loop jump loop back in the state machine jump down jump down there we go so gave us gave me a lot of errors obviously we don't have any conditions to transfer between these animations so the first one is this one our default from default to jump up and this is r is falling so we want to get that and if we are falling we want to go ahead and transfer to that animation now so we're going to be jumping it's going to transfer us to our jump up now we need to go inside of our jump loop while we are still in the air now over here what we are going to do is we are going to right click and we are going to do time remaining time remaining ratio on jump up so this is this as you can see it says get the time as a fraction of the asset length of an animation in the asset player node so this is basically how long have you been in that state inside of our jump up so obviously we want to make sure that it finishes running so we're going to go ahead and check if this is smaller than one and then we're gonna go ahead and plug this in so this basically will allow us to play the animation for a little bit and then go into the next state so let's have the next state so we have our jump loop and the next state is checking if we are no longer falling so we're going to get our is falling and we're going to do a not value on this one because we always need to return a positive value it always has to be true over here because it can't enter the transition so it has to be true if it's false it can't so we're going to flip our is falling so whenever our character is no longer falling it's going to say yeah it's true you can go ahead and proceed with the next whatever it is that you want to do and then the last final one is from jump down going back to our default state and over here again we want to do the same thing we did when we went to the loop we want to get our time remaining time remaining ratio for the jump down animation so that we can then check again if it's smaller than one and if it is we can go back to our default idle state once the animation has been playing for a little while so with this being added let's give it a try so now whenever we jump there we go you can see my character is jumping now i don't have the best animations as you can see obviously but if you have some proper animations this is going to look a lot better mine is very stiff and it has like this aiming animation added to it uh but other than that looks to be all right i'm going to leave it be for now because later on we're going to have a lot of different blending possibilities so we're going to have like the idle default hand position which is going to stay pretty constant constantly in the same position and then also we're going to have different animations based on whatever we are holding maybe we are carrying something maybe we have a weapon like in this case you can see he's holding like an assault rifle maybe a pistol maybe whatever and we're gonna cover those topics as well but for this episode that is going to be it uh we have some basic blend space set up ready to go and also i believe these values right here should be replicated as well because that is the default character movement and the default character movement is replicated as you can see he's running around and also the jumping is fully replicated because those are the default things that are just replicated by default inside unreal engine 4. so yeah that's going to be it for today's episode if you learned something new and think this is helpful and if you want to learn more make sure to subscribe if you haven't already and i see you in the next episode
Info
Channel: It's Me Bro
Views: 1,015
Rating: undefined out of 5
Keywords: ue4, unreal, engine, animation, tutorial, basics, basic, easy, walk, run, idle, jump, blend, space, setup, guide, how, to, blendspace
Id: _G6PF-XyYnw
Channel Id: undefined
Length: 13min 34sec (814 seconds)
Published: Mon Aug 30 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.