Unreal Engine 5 Create Stunning Ability Animations with Animation Montages

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello in this video we're going to go over how to add animations to our character abilities in Unreal Engine 5 using animation montages in this previous video we learned how to make our character move around but now we wanted to play certain animations whenever we press a keybind like Q or W and we want our character to use an ability alright so the first thing we need for for us to be able to build ability animations in our real ninja 5 is we need a bunch of animations to use and I have these three different animation sequences from the Wukong asset pack which I shared with you in the first video I'll also put a link to it in the description of this video as well so I'm using the primary melee a slow primary melee B slow and primary melee slow animation sequences in this video if you want to follow along if you are following along make sure you use these exact names and they don't have an MSA attached to the end or else it will ruin the animation so the first thing we need to do in order to use animations for our abilities is we need a animation Montage so the way you create that in Unreal Engine is you can click on the animation sequence you want to build a montage from right click on it go to create and then create anime Montage this will create it for you and it will put that animation inside the Montage we're going to give it a name I'm going to call this one am for animation montage and then basic attack so let's go ahead and show you another way you can do this as well you can just right click go to animation and then click on animation Montage but when you go this way you have to give tell it what skeleton you want to use which is in our case this is a Wukong skeleton the only difference is when you do it often animation sequence it does that step for you automatically and it adds that first animation inside of it alright so let's take a look at the animation as you can see in this animation Wukong is swinging his uh staff and this one also comes in with a sound with the sound we're going to go over how sounds work as well so if you go ahead and play it you'll see that he swings his staff and then makes the sound that he's making all right so as you can see it's not much different than the actual animation sequence right now but we have a lot more flexibility of what we can do with it the first thing I want you to pay attention to right here is that we have a default default group default slot these slots are used by Unreal Engine as a code between the animation montage and the animation blueprint so let's go ahead and open our animation blueprint so here we have our animation blueprint right here as you can see we have our movement State machine from the last video which is going into the output pose now what we want to do here is we want to right click and then search for default slot which is the code we were just talking about and you'll see that there is a blueprint for it so we're going to choose that slot default slot and it has an input pin and an output pin we're going to take the output of our movement State machine and plug it into the source and then take the resulting pose and plugging it into the output pose and then we're going to hit compile and save so what this is saying is use the animations in the movement State machine but if there's an animation playing on the default slot Channel or on the default slot code play that animation and then resume whatever animation that's coming in from the movement State machine so what we can do now is we can actually play this animation by doing the following all right so what we want to do now is open the blueprint for our main character which in my case is BP Wukong and I want to write some blueprint to add some blueprint codes so that whenever we press Q it plays it plays that at basic attack animation that we just created so the way you do that is you can right click search for Q keyboard which brings uh this keyboard events right here which is what we can use as input for now there are better ways of doing inputs in Unreal Engine but this is the most basic way that we can use for this tutorial so whenever we press Q or whenever the player presses Q we want to play that animation so the way you do that is again you click right click and then you search for play montage and you want to choose this node right here not this one and then it's going to create this blueprint for you and we can drag in from the Pressed pin to the player Montage pin right here and then we have to provide it a bunch of input variables it requires the skeletal mesh for this animation and we have that right here because we're we're in the bubble Kong blueprint we can just drag this and then attach it to the skeletal mesh component right here and it also requires the ability Montage to play we can search for am basic attack right here and we can hit compile and save we're going to talk about these other three input variables in a second so if we go ahead and play we can move our character around like before but when we press Q it's going to play that animation Montage just like that pretty cool so we have one ability playing and let's talk about some other things that we can do with the animation Montage so let's go back here one thing you'll notice with this animation specifically is whenever he swings his staff like it the whole animation the main part that we really care about is really up to here but after that it's just really a bunch of idling and it coming back so if we wanted to if we cared enough we could actually just remove the rest of this for example maybe we only want it up to this point right here up to let's say one second up to like 0.78 and we can change this end time in the so if you click on the animation on the top right there's a details panel and you can change this end time to be 0.8 and then press enter or tab for it to take effect so now if I actually go back you'll see that the animation is much quicker without that idling and you can hit save you can go again into play and when you press Q you can see the animation is much more responsive and much more faster again this is something which is preference based but I just wanted to show you that you can actually do that now the cool thing about this is that the change that you made is just an effect in your animation montage and it doesn't actually affect the original animation sequence so now that we have that I want to show you something else so we don't really have to work with only one animation in an animation sequence we can actually add in more animations so if we on the bottom right if you go into your asset browser you'll see a bunch of animations here that you can also drag in so for example this was my primary melee a now I want to drag in a primary melee B into the same animation montage and it puts it right here so if we hit play after it plays the first animation it goes into the second one continuously right so if we actually save this and go into and play this animation again you'll see that when I press Q he's going to pre play both animations in sequence and that in itself is pretty cool right you can actually create combinations with different animations but let's say that's not what we want to do we want to play only one part of the animation and not both of them together so the way you can set that up is twofold so first thing if you look at the top here we have default and this is the label that is associated to this whole to both of these animations together but what we can do is we can Define separate labels for each animation so if I right click here on the top and create new Montage section I can name the first section one for example and I can remove the default by clicking on it and hitting delete and then adding one here so that's our first animation I can right click again say new Montage section and choose number two for the second part and if you click on this icon on the top you can move it all the way to the start of the first of the second animation now what I want to do is I don't want the second animation to automatically play after the first one the way you do that is on the bottom right where you have the asset browser there is a montage sections so as you can see here what it's saying is play one and then go to and play two but I don't want that to happen I don't want them to play after each other so I can hit clear here and that'll clear that out if you want to set it back up you can click on this pick the next section and choose two for example and it will set that up again but I'm going to remove it so now both of them are not going to play together so what I wanted to show you is you can actually choose which animation to play in the Montage section in the in the actual character whenever you're using the play Montage you can choose a starting section so let's say we want to play the second animation so you say starting section two you hit compile and save and just for you to remember the second animation is the one is this one right here where he goes from the other side right so it goes from left to right and right to left so if I hit save go to play when I press Q you can see it plays the other animation and as you can see the other animation is so fast you don't really notice him I'm taking the staff to the left it kind of looks like he's pairing so what we can do is we can fix that so we can go back into the animation montage and we only want to change the second animation so the first thing I want to do is again it has a lot of extra time that I don't really need for it to be this idle so I can change the end time and bring it back all the way to 0.6 when I play the second part you can see it's much faster and much more snappier and what something else that I want to do is I want to reduce these play rate so right now it's 1.0 I want to redo this to 0.5 so now when I hit play it should be much slower again I started playing the first one I'm going to bring the header here and you can see it's much slower maybe too slow but let's save go back into BP go back and play and once I hit Q let's see if it looks better in the game it looks better but I think it's a bit too slow again you can play around with this but I just want to show you that you have this option so I think 0.7 is probably a good compromise yeah that's much better but again you can play around with these and you'll notice that we have much more options we can choose what section of the animation to play so what is the point of this I want to show you I want to show you guys a real example so a lot of times when you're playing a game that is auto attack based uh let's say World of Warcraft or even League of Legends when your character is doing basic attacks it doesn't just do the same animation over and over again right it seems like it's doing a random animations between a bunch of animations for basic attacks so this is one way you can set it up if I add another animation here so if I go into the asset browser and I add this third animation into the third slot so I'm going to create a new Montage section called it number three and I'm going to drag it all the way to the right I want to make sure that nothing is playing after each other I'm going to hit clear here so now I have three different animations that I can play and what I'm going to do is I'm going to choose randomly between these three every time a character every time the player presses three so I'm either going to choose one two or three and I'm just going to do it randomly so I'm going to go ahead into my blueprint right here now instead of giving it a number straight away I'm going to create a I'm going to choose a random number and the way you do that you right click and search for random integer in range so you want to choose random integer and range and I want an integer between a number one and three so I'm going to choose a random number between 1 and 3 I'm going to change this into a string and then I'm going to put this into a you have to convert it into a string and then I'm going to convert it into a name just like this so now I'm going to choose a number between 1 and 3 feed it into here and then play it every time the character presses Q so if I hit and compile and hit play now every time I play Q you'll notice that I'll play something at random sometimes it'll be the same ones but most of the times it's going to be different so for the last part I want to give you a small challenge that you can try and I'll show you how to do it so now go ahead and create a combo with using all these three different melee attacks so make it so that whenever the player presses W the Wukong will play all these attacks in succession so go ahead pause the video and try it out and then I'll show you how to do it all right so let's go back into the content browser let's create a new animation montage and we're going to choose this one right here we're going to do create create add-in montage and I'm going to call this one am combo and I'm going to open this one up right here I'm going to pause this again I'm going to reduce the time it spends in this animation by quite a bit I want the combo to be much faster so I'm going to choose 0.4 I want to make sure that it looks good yeah it looks pretty quick then what I'm going to do is I'm going to drag in the primary B melee this one right here and I'm going to see how that looks I'm going to go up to here probably because I don't want it to spend too much time in this animation so I'm going to reduce the end time again to 0.5 and make sure that this looks good and it I think it does and then I'm going to choose the last one drag that one in and again I'm going to make sure that it looks good and I'm going to go up to here maybe so I'm going to reduce the end time to 0.8 so now that I have that um I'm going to play it once to see how that looks all right that looks pretty good to me so I'm going to save this one go back into BP Wukong right here so this is my cue which is my basic attack I'm going to search for keyboard w ow and I'm going to add that in now I want it to play that combo so I'm going to copy this Ctrl C Ctrl V I'm gonna use the drag the Press into the player Montage we need the skeletal mesh which we have right here if you can remember we're going to drag that into here and we're going to play the animation Montage combo which we have here now if I hit I don't need to choose a section because as you can see we only have one section which is the default so there's no reason to do that I'm going to hit compile and save and now we're going to place play and I'm going to hit W and it should play all those three in a combo and that looks pretty cool right so now you have two abilities on your character and you can use this method to add as many ability animations that you want to your character in the next video I'm going to show you how to add sound effects and visual effects to your abilities which will make them really good and like a lot of AAA games abilities that you see in most common games thanks for watching and I'll see you in the next one
Info
Channel: SipAndCode
Views: 5,552
Rating: undefined out of 5
Keywords: Unreal Engine 5 Create Stunning Ability Animations with Animation Montages, SipAndCode, Unreal Engine 5 Tutorial, gamedev, game development, Animation Montages, ue5
Id: csscEgsgP18
Channel Id: undefined
Length: 15min 34sec (934 seconds)
Published: Wed Sep 20 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.