Hard Fall Landing | Long Fall Landing Animation - Unreal Engine 4 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys and welcome back to another mention 4 tutorial in today's video i'm going to show you how to create a hard landing or a hard falling animation so if you fall from a certain height or if your player is falling at a certain speed what's going to happen is when they land they're going to play a different animation instead of just suddenly landing so i'll show you something like so if i just go up this quick elevator that i've made you can see that when i fall i've also got a print string to tell me when i've achieved this certain speed for to create that hardware animation so you don't need to be this high this is just for a demonstration so from falling off you see i've reached that speed hard full i'll land and i've got this hard full animation there and now we can just walk about again so that works perfectly so i'll show you that one more time and then we'll get into making it so if i go up here and if i fall from here as well this should still work so i've still got a bit up and there you go we've now got it so that works perfectly so like i say i'll be showing you how to do this now but before we get into the rest of it this video is actually sponsored by gauss ed galactic salvage and disposal gauss hat is an arcade-style space flight game where the player blasts space debris harvests energy and mines valuable ore from treasure rocks in order to score points the developer was also kind enough to give me a free steam key so i have played it in my honest opinion i love it i think it's great and the fact that everyone's resource attraction on leaderboard gives it that extra competitive and fun edge to it the game is also a very cheap 99 cents on steam or 75 pence depending on where you're from but it is cheap and great the developer is also one of you someone who learned from these videos that i'm making and so this is very possible for you to do so i definitely recommend checking out and also supporting them as like i say this is someone just like you so thanks so much gail said for sponsoring this video and make sure to follow the link in the description down below to go to their steam store page so our first step is you're going to want to import the animations that we're using so this is just a quick one that got mixed mode and retargeted to the ufo mannequin so it looks like this so once you've imported that so by just dragging and dropping it in you can right click on it create create and in montage as we're going to be doing this via animation montages hit enter and there you go we now have that there now you can open this up and change the rate scale if you want so that's just how quick it is so you set on two it's a little quick like that but i just want it as one as that's a good speed for me so i'm gonna save and close that then next what i'm gonna do is we're just gonna open up our character blueprint as that's basically where we're doing all of this code so for me that's content third person bp blueprints that person character but for you this could be third first well if you've named it so what you can do is you're just gonna find some space so i think down here will be good for me and i'm just gonna right click and i'm gonna get event on movement mode changed so when our movement mode changes we're going to call this function so after new movement mode i'm going to come up with this and get an equal and so equal am down here and this is going to be falling so if we are falling we then obviously want to play the animation when we land talking about falling hold down b left click to get a branch plug the condition of that in there actually just before this branch we'll get a sequence so hold on s left click to get a sequence and then connect those up like that sequence is something we're going to be using later actually i'll move that like so so that's just so we are prepared for it after this what i want to do is we just basically want to see what speed the player is falling at so to do that we're going to right click we're going to get velocity so get velocity like that should be the very bottom there and we're going to right click on the return value and split the stretch pin as we only want to see the player speed on the z axis so we're going to come out of the return value of the z i'm going to get a less than or equal to float is less than or equal to a float the reason doing less than is because this is going to be a minus number as we're falling down it will be minus so obviously when it's a minus the number's getting bigger it's getting closer to zero obviously we want to be getting further away from zero so it needs to be less than and then the value i'm going to put in here is minus 1500 but you can set this to be whatever you like now a good way to test this out is to right click and just get the event tick node out of the execution of that we're going to get a print string the in string is just going to be this return value z there now compile and play it we can see up in the top left what speed the player is going to be falling at so if we fall off of here and jump we're going to get to about minus 800. so this is why i said to minus 1500 so it's not from a height like this but it would be something like this so obviously that's quite high that reached minus 2200 so minus 2200 was from that height so like i said i think minus 1500 is good for me but you can change that to be whatever you like so i'm just going to delete that as i know what value i want out of this i'm going to hold down b left click to get another branch plugging that into the true of the first conditions obviously there's less than or equal to so if our new movement mode is falling we then want to check to see what the player's speed is on the z so to see if they're falling if it is less than this number so if they're falling at that speed or greater than that speed so obviously it's less than because it's a minus number but we're going to say greater than so if it is like that we want to make sure that we are going to have a hard fall i'm going to hit the plus variable and call this hard landing or hard fall question mark anything like that plug it into the true and set it to true so if the player is falling faster than this downwards they're going to land hard if they're not falling faster than that hold down d left click to get a delay leaving at 0.2 and we're just going to then call this a function again so as long as the player is falling we're going to constantly check their speed to see if we need to have a hard fall as soon as they stop falling it will come out false so we'll no longer call this so to do that we're going to do is we're going to right click up here get a custom event and call this check speed and i'm just going to plug that into the first branch there then back down here after this delay we're going to call function check speed and that is that part done so like i say when you first change our movement mode it's going to check if it's falling if it is it's going to check the player's speed falling downwards if that is greater than the speed we want it's going to set that to be true so we have a hard falling if it's not it's going to constantly check to see if the speed doesn't get above that until we land and if we land it will go out false so it won't check this anymore and then if it does reach that speed it'll come off here so it won't call the function again so this is only going to do this loop for however long we need it to so now what we want to do is we've got it set up to determine when we need to have the hard fall animation now we just need to actually play it so to do that we're going to come off of this sequence here and do it down here so what we'll do first let's come out of new movement mode get another equal anim like that this time it's going to be walking so we go back to our walking mode which is obviously when we've landed out of this return value what we're going to do is we're going to get an and boolean this other one is going to be hard landing so if our new movement mode is walking and we want to have a hard landing then it's going to play the animation so hold down b left click to get a branch plug that in there and that's just going to simply check to see if both of those are true then connect that to the then one of this sequence up here like so our false we're not going to do anything as obviously it's fine then we don't need it to do anything about true we want to play this animation so we're going to do is we're going to come out true i'm going to disable input actually disable movement so we'll get the character movement here drag out this and disable movement and the reason we're doing this is because when the player is having that hard landing we don't want to be able to move around as well as that won't look good with the animation and it's also not as realistic so we're going to stop them and prevent them from moving and then once the animation is finished we'll let them move again out of this what we're going to do is we're going to play anime montage so play and then montage like that with the anime montage as a hard landing montage that we made earlier so that way it's going to play that now for the execution of this we're going to set hard landing to be false so that means that the next time we go into the walking movement mode it isn't going to play this animation again it will only do it when it gets set back to true here which is obviously if we're falling at that speed out of this we're going to come out the return value of the player montage and get a delay delay like so now the completed of this we're going to set the movement mode again so we'll come out the character movement here let's come up here and get a reroute node like that and then out of this i will set movement mode and i'll set it back to walking so change new movement mode to walking and now when you do that it will fire off this line again but because we've set hard landing to be false it won't do this again so that will now work perfectly so we've set up to check when we need to have the animation play and this is actually playing the animation so compile save there's one final step we need to do which is actually uh to allow our player and our animations our character to play this animation here so we can just close that and then open up our animation blueprint so for me that's content mannequin animations third person and mbp in here you just want to go back to the anim graph here so you might be in the state machine so just press anim graph up at the top there out of this default state machine we're going to get a slot default slot and all that does is it just allows the use of animation montages so we compile save close that we should see this working so if we hit play to test it i'm going to go up on this elevator that i made here just to test all this out once i get to the top what i'm going to do is i'm just going to jump off and you can see when we land we should have that hard falling animation like so so that works perfectly now if i just fall off of this or jump off of this we're not going to have that animation it will just land normally as obviously we don't want it to hit there now if you think that it plays the animation from too small of a gap too small the height whatever so you jump off of something and it plays it when you don't you're just going to increase that speed value that we made in the blueprint here so let me open it back up again you see you would just change this value you just increase that to get it to be a higher gap so i have to be falling at a faster and a greater speed so i think i'll be if this video is we've done everything we wanted to do we set it up so that we fall from a certain height and we reach a certain speed it's going to play an animation so you see from that it didn't do anything but if we go all the way up here it's going to play that speed and now i don't need to go this high but i'm just doing it for testing so if i jump off of here you can see that when i land and hit the floor we're going to get that hard falling animation there so it just makes it a lot more realistic now obviously from that height you'd probably want to kill the player and have full damage but for this one i'm just showing you how to have that hard landing animation like so and that works perfectly like that so thanks so much for watching i hope you enjoyed and i hope you found it helpful and if you did make sure to like subscribe down below so thanks so much for watching and i'll see in the next one you
Info
Channel: Matt Aspland
Views: 21,044
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, ue5, unreal engine 5, anim, animation, montage, animations, falling, fall, fell, long, speed, velocity, hard, landing, hard landing, realistic, realism, quick, easy, from, height, long fall, hard fall, jump, jumping, end, ground, hit, walking, walk, movement, mode, play, only, small, not, on, free, blueprint, blueprints, advanced, loop, of, blendspace
Id: -__BWLT37uk
Channel Id: undefined
Length: 10min 21sec (621 seconds)
Published: Sun Dec 13 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.