Unreal Engine 5 Tutorial - Animation Blueprint Part 3: Aim Offsets

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello and welcome back to our animation blueprint tutorial Series in the previous episode we looked at blend spaces and now we're going to look at an offshoot of blend spaces and look at aim offsets this is how you make a character like aim around and look around based upon which direction you're moving the controller so let's take a look at how we create this new additive type of animation okay so next up in our animation blueprint we're going to work on adding an aim offset to our character so aim off sets essentially allow you to move part of the bully separately and independently from the other possibly and the way it does that is through what we call additive animations and so when I look up it's going to aim the like his head and gun up and when I'm going down here when he's gone down left right and so on and additive animations basically means you're adding on information about the animation on top of whatever animation is currently playing so if you've got a character with an animation pack you're looking for an aim offset now they could be done in a couple of ways one is like this this is the ideally the best way because these are always separated out for you and you can see here there's Idol AO AO means aim offset and CC Center Center so this one is him just looking straight ahead and this is all they are they're just animations that are literally just one frame long suppose that you want and each one of these on the asset details you want to go down and make sure they have additive settings set to mesh space and they're using the base pose type of selected animation frame and using an idle pose this is so it can work out the changes of animations oh this was pretty simple this one's just looking straight forward so is the idle so there's no change going on here but if I was going to set it down this one's still saying Center Center like straightforward we're now measuring it downwards so any movement going down any changes this have compared to this one is what it's going to apply and that's how additive animation works so you just need all the animation offsets for every single pose so I've got centered down Center up but left back Center left back down left back up left Center down and so on and so forth okay and also provided to hear some non-compact ones so you're just standing still and you're looking around not aiming your gun so now this pack does come with this IMO sets already made but we're gonna make one from scratch so you can see how these work so let's go ahead and create our aim offset I'm going to go back over here and go to aim offset in animation menu choose your skeleton and we'll do revenant aim oh I oh aim offset and open this up now we've done blend spaces the last time and this works basically exactly the same as a Bend space we have this graph that's two-dimensional and we can apply those to different animation poses onto this graph you need to make sure you set the graphs up first so let's go to the horizontal axis and vertical axis on the access settings hold on to one we're going to name is your and that's going to go for minus 90 to 90. and we'll tell snap the grid again to make life a little bit easier and the vertical axis is going to be pitch so pitch is up and down your is left and right and rolling is like you're turning like you're rolling your head to left wall head to the right so your picture the ones we want to use here and picture again will go between -90 and 90. and turn on Snap to grid that will do for our axes so our next thing we've got to do is we need to just plug in our different poses uh let me try and get this so you can see what we're doing here okay so I'm going to idle AO so I'm going to put in my Center Center usually first I'll put that into the center here and as soon as you add this you may get some weird artifacting and that is because over here it's also assigned this animation to be its own preview base which you don't want you want the just idle pose to be the number one so go to idle and that'll now be set to be the base pose for this so that's the census Center Center we're going to Center down flipping that down there why don't you keep changing this we'll change it in there Center down Center up and if I change this back to idle we should see those changes happening there we go so if I move it up it aims up and it's nice blend between the different animation poses okay uh next we've got left I'm looking to get the back ones to do left Center there I don't know why I keep resetting this it's quite annoying let's look we'll place them all in there and fix it so left Center left down left up um right Center write down right up and let's just fix that setting up to idle there we go so now my cat can aim in that entire space which is quite nice so I'm going to hit save and go to our animation blueprint and we can add an aim offset to our animation graph by going into like usually here because you need to feed it because it's additive it needs to be fed a animation to add onto so we go drag our our Revenant AO oh that's quite wrong and it is a second it'll be so and here we've got your own pitch coming through on here much like how the blend space works it works exactly the same as that but being additive you can see it receiving a bass pose so you plug the pose into the bass pose then you plug in the output into the output so it goes in adds the value onto it and then puts it back out so at the moment nothing's gonna look anything different because now your pitch is set to zero so these need to be verbal so I'm going to right click on these and promote them to verbal like that so let's now go back to our event graph um which is there and now I need to calculate my yawn pitch now I tend to do this in its own little function just make things a little bit tidier so I'm going here and do calculate your pitch and what you gotta do is basically you need to work out the difference between where you're aiming with the camera which way they're facing and then we call that the Delta so if you get those two rotations and get the Delta of those rotations so let's do try and get Pawn owner and there we want to get control rotation which is the way we are looking with the camera and we also want to get the actor rotation and you want to get a difference between a two so from control we're going to do Delta Delta just means difference so it'll work out a difference of rotation between those two and then we're going to do an R interp two now we're using an r interp two to smoothly transition the values across that way it doesn't look all stuttery it'll come across a bit smoother I'm going to put the Delta into the target there Delta time I'm going to drag out and do Delta wild seconds and internet speed I like to put three and then I can adjust it as I want later one high or low if I need to so on the current you have to put in the current value you calculated so I'm going to do is drag out this and do make rotator and you plug in your pitch and plug in your your so we're calculating what these values are making it into current Rotator getting what a new rotation should be and working out what it's heading towards with this and so now I just need to Output this into the pitch in your variables so what I'm going to do is I'm going to split this to get my different rotations out and on the pitch we're going to do clamp float uh to clamp angle I'm going to go between -90 and 90 because that's how far we set the aim off set so I need two of those one for we pitch one for your and we'll set that to your there and set that to pitch there and we'll just hook those up and where's my Pebble node that is and we'll plug that in okay so now if we go back to my event graph I can just Chuck this onto the end to calculate my yawn pitch so let's take a look at that in game so as I aim down you can see his character model is aiming down now aim up the aims up now left and right is a bit difficult because at the moment he's turning with us which we don't really want to do and because it looks like he's spinning on a circle so what we're going to do is go to his character blueprint um nope uh I'll have to put it in here we're going to play on Okay so yeah on here I'm going to go to my uh correct movement settings go down to rotation and I'm going to turn use controller desired rotation off so that way he won't turn when I'm turning um and hit compile on that one for now and you can see now if I turn to the left he's going to aim to the left and to the right down up you get this nice sort of movement going into it and that's the aim offset so I mentioned before that there are two ways you can normally get AIM offsets uh like the poses one is if they're already separated out for you it makes life really easy if they're not separated for you and they will Bunch together into one animation which sometimes happens um I don't know if this one has it let's have a look um I don't think they do no it's just getting back the other ones so if they're all bunched together uh let's say for example this is like playing all of them all together so the character's going up and down left right is doing all the different poses in one you can export each one you just go to the frame you want to export and do create asset create animation from current pose and you save out each pose as their individual animations and there you can plug it into the aim offset like normal okay that's how you do that so there you go we've now got our aim offset working we can see that working with animations uh in the next episode we're going to go through the process of creating montages and looking at layered blending look at how we blend different layers of animations together using their bones so you can watch the next episode right now over on patreon.com forward slash Ryan laley we can find all my videos early from just one dollar a month thank you took my patrons and YouTube members for the continued support and make sure you're subscribed and I'll see you next time bye everyone thank you [Music]
Info
Channel: Ryan Laley
Views: 16,840
Rating: undefined out of 5
Keywords:
Id: E7ApbstVTd8
Channel Id: undefined
Length: 13min 22sec (802 seconds)
Published: Wed Oct 04 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.