How to setup Aim Offset in Unreal Engine 5 | Animation Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign here welcome back to a new video in today's video I want to cover a very common topic and that is how can you make aim offset in your game so when we hit play here we have a character here it just has an idol animation that moves forward and it just just uses the movement from the third person project so let's go ahead and make sure that this guy can now look up and down and that the guy then responds to the aim offset so the way that we're going to do that is that first of all you're going to need some assets So I myself got this blocky character here I got this animation for either I'm running and then in here I got my tree aim offset animations and the important thing is that these animations are all one frame so if you look over here you see that this is basically just one frame and that's it and then the way that I named them is that I say as which stands for animation sequence and then AO and then we got three of them so we want one for down one for Center looking and one for uplooking and it is important that you also know where your idle animation is because we are going to set up the aim offset with a preview animation in there which runs off of your idle animation so the first thing you're going to want to do is inside of the folder where you will have your aim offset animations you are going to have to right click and then you go over to animation and then find yourself the aim offset now you can make aim offset that also is directional so that means you can also lean left and right but in this example over here this is one directional because it's only on the pitch up or down basically so we are going to select the aim offset 1D and then select your skeleton and then let's call this something like aim offset 1D blocky because blocky is my character here so I'm going to open this guy up and then over here we are going to have to set this up with with all of the aim offsets but before we can drag the aim offsets in here we need to adjust them a little bit so the first thing that I want to do is go into each of these and adjust them the way that they need to be adjusted so let's start by opening up the down animation here so what you're going to want to do is scroll down here to the additive settings and then click it from edit if to mesh space and I select the skeleton reference pose and switch that to selected animation frame and then over here it asks you for an animation frame and that is going to be your base frame and the base frame is always going to be the center one so even though this is down we are now going to select the center one just like this and then if you go ahead and click the little arrow here then this one is set up correctly go ahead and save then we're going to do the up one so also scroll down to additive make it mesh space this one set it to selected animation frame then select your Center and select it over here hit save and undo Center itself so also over here mesh space selected animation frame select Center and plug it in here there you go hit save and that's it now we can put these three inside of here so when you open up this aim offset file then you want to go here to horizontal axis and this you want to name your pitch because we're going to be looking up and down and then the page is going to be from -90 to 90 and we can make it a great division of 2 and then we can set it to snap you see we have a grid here on the left in the middle and on the right so what we're going to do is minus 90 will be down Center will be here in the middle and up will be here on the right 90 degrees and then you see that your character gets removed here so you don't see your character and then what you want to do here is what I mentioned earlier you want to set up your idle Post in here so if you then go ahead and locate your normal idle animation select it then you can plug it in here and then you character should appear again then you can hit save and then to preview of the aim offset works you can hold Ctrl and I scroll like this so now you see that this guy is starting to look down up and in the middle which means that we correctly set up this aim offset now all we have to do is add this aim offset to the animation blueprint and I make sure that animation blueprint can basically reach the pitch so that it can work so right now we can go ahead and close this aim offset and then go ahead and locate your animation blueprint so for me I got it over here ABP blocky open that one up make sure you go to the event graph you can also go there by double clicking here and then you should have some logic that looks like this so on event blueprint initialize animation you you want to get the owning actor of this animation blueprint cast to the character class save that also get the character movement component and then untick here so that means event blueprint update animation you want to validate that character and then well for one this is just for my basic animation logic we want to get some ground speeds that's my logic over here but now to get the pitch we are going to make a sequence here so hold s and left click so let's hook this up and then I'll run you through it real quick so basically from that character reference that we have over here we want to get the base aim rotation and then the actor aim rotation we then want to have a Delta Rotator so you get one by typing Delta Rotator and here it pops up just like this then you want to split this value over here so right click it and hit split struct and then the Y value which is the pitch is the one that we want to store as a variable here after we got this variable here from the event graph we then want to go ahead and set up our animation graph with this aim offset so if we then go to the animation graph we can find ourselves this here so this is my basic state machine and here we have the output post and then what we want to do is in between our state machine which runs all of our Locomotion logic then in between here we now want to drag in our aim offset here and then you want to put your state machine logic in here this should contain your Locomotion and this one then goes into the result and then for the pitch over over here we are going to drag in the pitch and plug that in just like this then if you go ahead hit compile and save you'll see that this line pops up here and that's basically it so now if we go ahead and hit play Let's see if I look down the character will start to look down like this and if I look up you can see that the character will start to look up so right now yeah the basic third version character does not allow me to control the character like that I want it to strafe for example so but you do see that the aim offset goes up and the aim offset goes down if you do want your character to strafe then that's very simple actually you just go into your character blueprint go to character movement over here scroll all the way down over here and then turn this one off and turn this one on and I set this value here to -1 then if you go ahead and hit play then you see that you can walk directionally like this you can strafe but you would of course need strafing animations but what we can see here is that we can now look down and we can look all the way up so that's how you make aim offset and this also works automatically in replicated games so if I got two games here and I click on play then we can see that we have the client here on the left and both the server and the client can see this guy looking up and looking down and then the same goes for the server so the client can see the server looking down and looking up so this aim offset is automatically multiplayer ready and replicated for us alright guys that's it for this tutorial I hope you enjoyed it if you did be sure to give it a like And subscribe that really helps out the channel also be sure to check out our patreon you can download awesome multiplayer example projects there and also please be sure to check out our inner engine marketplace where we make amazing game templates that will greatly help you with your game development Journey alright guys see you in the next video bye bye happy birthday [Music]
Info
Channel: Kekdot
Views: 12,254
Rating: undefined out of 5
Keywords: Blueprints, Unreal Engine 5, Unreal Engine 4, Steam, Multiplayer, Game, Marketplace, Game development, Unreal Engine, UE, Multiplayer game, Tutorial, Online, Multiplayer Unreal, Replication, MMO, Game Engine, Devlog, Dedicated Server, Game dev, Learning, Vlog, Video games, make games, Unity, Aim, offset, Aimoffset, animation blueprint, animation, blueprint
Id: AFt5gc2lePY
Channel Id: undefined
Length: 7min 54sec (474 seconds)
Published: Tue Jan 17 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.