How To Make An Animation Blueprint And Blendspace - Unreal Engine 4 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys and welcome back to another on religion 4 tutorial today I'll be showing you how to create an animation blueprint and also animation blunt space and what this does is it allows your character to be animated and smoothly transition from idle to walking to running to jumping or any other combination of those for now these are the four basic animations on video today however you can do as many as you want but these are the main ones that you'll find in almost any game so in the last episode I showed you how to create a character and animate it and then we imported that model and those animations into our game here which I put in the third person VP blueprints anime characters so our characters there and then the animations are all in here and so if you don't have a character and the animations and I recommend you to go watch that video first which is on the screen now but if he's got your character animations let's move on to the animation blueprint itself so I'm making it in a third bus in BP and then blueprints folder here so it's with the third person character blueprint so we're going to right click go into animation and get an animation blueprint make sure you set the skeleton to your model that you've created and imported so mine is firefighter male one skeleton click that and here okay and call this whatever you want I'm gonna pull that firefighter male underscore and in DP call it everyone bide recommend any and and in VP to ease the differentiate between them all so once you've done that open it up and then right click here and add a new state machine what this does is it allows us to add in all the different animations in there and the transitions between them instead of just having one single animation in here hook it up and call whatever you want I was gonna call it firefighter male state machine and then open it up like so and here you can see you have the entry point and we can put the different animations in here so dragged off the entry point and add a new state I'm gonna call this idle and drag off the idle adds a new state again I'm gonna call this one walk and run and then dragged off the idle add another state and call it jump and then as you obviously tell this is going to have the idle animation in its off the walk of run animations and this will have the jump animation and these arrows are the transitions between them so you can go from idle to jump an either to walk run but you can't go back to idle or between walk run and jump so to do that we're gonna add the more transition errors in so you're just simply dragging drag from one to the other so go from walk around to jump jump back to idle walk around back to idle and jump back to walk run like so and now what we're gonna do is put in the animations so if we double click the idol drag in the idle animation plug-in there if you hit compile you can see that as appeared in the top left of you here so we know that's working it back to the state machine your walk run we're gonna put in a blend space there which will create later on so then go to jump and they're putting the jumping animation like so now what we're gonna do is set the transitions between them so to be able to go to remind with jump engine back to idle and so on and so forth so to open the transition you click the little icon that next to the arrow so I'm going to be doing the idle jump first so you open that up and then we're gonna see if the character is falling then I'll play the jump animation so to see if the character's falling we're gonna go over to the event graph up here like so so then off event blueprint update animation we're gonna go out and cast to our character mind being the third person character and as the object you're gonna want to try get porn owner like so then as your character you're gonna want to simply do type is falling and it will get this function like so and then off the return value we're gonna right-click and promote this to a variable which I'm gonna call is falling there we go and again make sure they are boolean but it should be anyway so hit compile and you will have some errors here but that's just because we haven't finished yet so go back to the state machine rules and then here simply just drag and drop in this variable from the bottom left and it gets dragged off and then do equally cost again equal boolean and click that so that it's set to true so is falling set to true it will play the jump animations now we're gonna just copy this and just basically paste it in for the other transitions here as well so jump back to idle we're gonna paste this except now we're gonna uncheck it as we want it to be if the character isn't falling anymore then it will play the idle animation and so then do the same fully walk run to I'd also walk around to idle so I walk run to jump it will be checked and then jump back to walk run it will be unchecked like so so now we need to make the blend space fully walk run animation so if we close this go back to here right click go into animation and then blend space create this make sure you set it to the same skeleton again and call the way if you want getting I'm just in a coal mine fire fighter male underscore and in bs4 blend space open that up and then here you have this graph here so the horizontal axis we're gonna call direction and the vertical axis we're gonna call speed now the minimum axis value for direction or the horizontal we're gonna have is minus 180 and the maximum as 180 I leave the rest the same and for speed it's gonna be our minimum and maximum values for the player so the minimum will leave at 0 and in the maximum I'll set to 1200 as that's the maximum as that's the run speed for my player that's the fastest he's going to be going and then we're gonna set the interpolation time for one so that it has a nice smooth transition between all the animations so then down on the graph down here we're gonna want to drag in our eyes animation and put that on all of these bottom rows down here like so and then in the middle we're gonna drag our walking and then the top are running and if you hold shift or move this green diamond here which shows you a preview of what the animation will be at that given speed and direction so it when you're not moving it will play idle when you're going at normal walking speed it will walk and then when your players sprinting it will run its that watch perfectly we can save and close that it's now back in the state machine if we go to the walk and run and then just drag and drop this blend space in here like so and pluck in that will work because II we need the variables for the speed direction so if we just promote both of these two variables like so and then name them so we know which one is call this one obviously speed and the top one direction then to get the speed and direction of our player to put in here we're gonna go back to the event graph and then off as a third person character or just whatever your character is we're gonna want to get the velocity and then also get actor rotation I'm just gonna move these down here need up a bit more give me some space and then off the cast we're gonna want to calculate direction like so and it obviously plug the velocity into there and then the axe rotation into base rotation and leave the target is the self and off the return rally we're gonna want to set Direction like so make sure all it's all plugged in properly and then off the get velocity again we're going to want to get a vector length squared just to turn the vector variable into a float so we can then drag off the return value and set the speed and again plug all this in and then make sure that you re plug in that it's falling boolean like so and that should be that all set up it's now hit compile go back to the state machine and that's now done so now go back to the same machine again and we'll do these transitions so the idle to walk run it's gonna be so double click that and then get the speed variable get speed and then we're just gonna do a float is greater than or equal to a float and then we'll set this to a nice number like 10 so if the players velocity or speed is greater than 10 then it will start to walk and run and then obviously the opposite for going back from walk around to idle so begets speed and then float is less than or equal to ten and then if it is it will play the idle animation so now go back to state machine and this should now be done so if we close this open the third passing character and then go to the viewport if we click on the skeletal match here and then set it from the base mannequin to our own model mind being firefighter like that there we go and then under the animation we're gonna want to use animation blueprint and the an in class it's the animation blueprint we've just made so a search for an MVP there we are firefighter male and a VP hit compiled bankruptcy it's already working it's now if we close this hit play we can see that the player is not moving so we have the idle animation playing right there so it's just a nice simple breathing animation and if we're walking it's playing the walk animation and we're I in a place of run animation and the player can also jump so obviously this doesn't look too good but that's just because of the animations I've chosen so obviously with your own animations it will look a lot better but we can be walking and jump like so or we can just be idle with a standing still and jump and it plays all the animations properly and you can see if we're running and suddenly stop it goes between the animations nice and smoothly so I think that'd be it for this video I've done everything I wanted to do we sell the animation blueprint and the blendspace all perfectly work so we can go from idle to jump and walk run to jump and between all the different combinations of that and in the blend space obviously has idle walk and run in so if we're standing still we're idle were walking and running and also jumping so thank you for watching I hope you enjoyed and hope you find a helpful and if you did make sure to LIKE and subscribe down below so thanks for watching and I've seen the next one [Music]
Info
Channel: Matt Aspland
Views: 119,683
Rating: undefined out of 5
Keywords: ue4, unreal engine 4, unreal engine, tutorial, ue4 tutorial, unreal engine 4 tutorial, how to make a game, how to, 3d modelling, blender, unity, games design, graphic designer, animation, animations, blueprint, blendspace, idle, walk, run, jump, how to make, animation blueprint, ue4 animation, anim, anim bp, bp, bs, anim bs, smooth, transition, make, ue4 animation blueprint, run animations, walk to run, idle to walk, idle to, walk to, jump to, to, from, back, dynamic, speed, velocity, direction, ue5
Id: 1K-Hyu4Xn3g
Channel Id: undefined
Length: 10min 36sec (636 seconds)
Published: Wed May 06 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.