Enhanced Input mapping in unreal engine 5.1

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi I'm 99 sorry and in this tutor we're gonna talk about enhanced input action or enhanced input rate this is the new thing in our real engine and it can get a little bit confusing but I will show you everything in here so you will see that it's a lot better than the old system so without further Ado let's begin so first of all in here I have this Pawn right it's just a pawn let me show you you can see it's just on so if I run over game you can see nothing is happening it's just camera with the mesh right so the old way was that we go to edit we go to Project setting and we did go to input and in this input we Define some action mapping access mapping and all of that but no it's changed to enhancing put actions so let's just learn that how it work so first thing to do let's just create a new folder and to call it inputs maybe you should do that as well in here first thing to do right click in here go to inputs and in this input two important thing is this input action and input mapping context so first thing go and create an input action and in this input action I want to call it I a for input action I want to call it move right so double click on it to open it and you can see it is a very simple things first of all we can define a description for this this is for moving of over character right or whatever you wanted put in there next consume input you want to get any input in here or not default it is true and we need that right trigger when paused is for when we pause our game should these IA move works or not because we don't want to move when we are in a pause State we leave it as false so next important thing is the value type do you want it to be Boolean just a Boolean pressed or not pressed or do you want to be access 1D it's exactly like axis mapping in the old way right Axis 1D but the beautiful thing about this new system is access 2D and axis 3D right so let's just start with digital Boolean right just true or false so no just with that with the Boolean let's just save this next thing that we should do in here we should right click go to input and create input mapping context Okay click on it input mapping context IMC and I want to call it default or whatever you want to call it double click on it to open it and in here you can see there is nothing in there first in I want to create a mapping for where I a move that we just create click on this plus expand it and in here choose your input action right click on it so in this move whenever we hit W for example it will give us one because in here we choose digital Boolean in here so whenever we hit W it will give us one so just with that let's just save everything go to our blueprint so in here first thing to do we should tell Ariel engine that these IMC we want to use it's all input actions right so we should add it to our blueprint so it knows that it should use that right so first thing to do in here we should get controller so you should do that every time that you wanna add another IMC you can have multiple right I will explain that more next thing to do we should cast this to player controller right so after we cast this we can get enhance input local player system subsystem right and with that we can add our mapping context okay it needs execution pin so let's just give it that and the mapping context is this the one that we create right just choose that and that's all you need to do in here you can see there is a priority that I will talk about don't worry about it just with this we can access this IA move so in these are a move that is digital Boolean whenever we had W it should give us two or one right so no let's just right click in here and search for IA move right so in this IA move it's not like before that has pressed release and all of that right so let me explain everything in here first of all you should see that the action value in here is just a Boolean why because I a movie decide that it is a Boolean right so just bear in mind for this next thing is this triggered okay so this triggered will happen 60 times per second if your game is 60 FPS right so as long that these IA move is happening this trigger will happen with it this I move have an start and have a completed and when these completed executed this triggered won't happen anymore so let me show you for the start at this case because we have a Boolean we have digital Boolean for this IA move this start it's like a pressed and this complete it's like released right so let's just see how it works if I just use these triggered what will happen let's just print something bring to the string okay so this trigger will be happening when we are holding these uh W for in this case and it will happen 60 time per second until we release this W right so let us see that the action value it is just a Boolean so let's just connect it here to see it give us a true and false compile and run and know if I had W in here you can see it's just saying true right if we disconnect this execution pin and connect the started it will print through just once so let's just compile and run a doll you you can see it's just writing true nothing more right until you release W this trigger will happen 60 times per second but this started will happen once because the Pressed is happening once next incomplete so what I want to do I want to delete this and in here I want to say started okay and in this uncomplete again I want to use another printer string in here and say completed okay so know just with that if we compile a run over game a w it says started if if you release it it says completed so no you know that trigger will happen between when a start is happening until the completed is happened and it will give us action value that is just a Boolean because we decide that it is a Boolean so know with that let's just delete this I'm I want to talk about other options for this value type I want to change these to axis 1D okay X is 1D now if we save this and go to our character now you can see the action value in here is is a float no it's not a Boolean type anymore because we change these value type from Boolean to float or axis 1D right so no if I again print an S ring in here and print this action value to here right we can compile and run and if he had W you can see it print one and if you release it it won't print one anymore right and it's not just that let's just delete this if I change these value type to for example access 2D that is that will give us a vector 2D let's just save it and see now you can see the action value now has X and Y it is a vector 2D and if you want to show that here what will happen if we had W on our keyword it will change the value of x to 1 and the Y is zero right so you can see and again if you go here and change these axis 2D to axis 3D what will happen now you can see the action value no is Vector 3D or location or whatever you want to call it it is Vector 3D right now if we show it in our printer string it will show you X Y and Z and if we have W on our keyword it will change the first value that is X right at w you can see X is 1 Y is 0 and Z is 0 as well okay it will give us three value so if we release the W it won't print anything you can see the x is one y zero Z zero so now we know what is the difference between all of this value type if you put digital Boolean in here it will give us a action value of type of Boolean if we change these uh value type to access one t it will give us a float and if we change it to Vector 2D it will give us X and Y it will give us Vector 2D right and because we want to have moving forward backward left and right so we need Vector 2D right we need to know if we go if we should go forward backward left or right we put the value you type to access 2D no let's just save it and you know that it will give us a vector 2D we can right click on it and split the strike pin so it will give us X and Y okay no if you go to aware context in here if we hit w at default it will put one in the X right no let's just again bring back these two a stroke pin so we can show it clearly no if we go to our IMC in here you can see when we hit w at default it will put one in the first input that is X right so whenever we had w x should be one let's just add another one for example s whenever we hit is if we leave it as it is if we had only or if we hit s in both cases X will be one let us see save everything and play if I had W it change X to 1 okay and if I hit s again again it put 1 in The X we don't want that whenever we hit s on or keyboard we want to put minus one in the X for example right how we can do that we can go to modifiers and add a modifier in here right and there are some modifier in here that we can use and we can we can create our modifier ourselves don't worry about that because there is a lot of them in here that can help us a lot right now what I want to do whenever we hit is we want to put -1 in the X right so we can negate that to -1 okay so no whenever we hit W it will put 1 in The X and whenever we hit s on or keyboard it will negate that one to minus one and put it on the X so let's just save that and run our game know if I had to W it will give us 1 for the X but if we hit s on our keyboard it will give us -1 index just look at that minus one in the X because we did negate that value right so no I don't wanna use x for going forward and backward you know that whenever we hit w we want to go forward and whenever we hit s we want to go backward okay so we don't need to put the W and S values in the X we want to put it in the Y right so you know that we have X and Y in here and we want to put this w s value in divide not in the X how we can do that we can again use modifiers so for example let's just delete this modifier I will do it again whenever we had w we wanna put one on in y right not X or we can do that we can use modifier let's just add a modifier and in this modifier I want to use Swizzle input access value and what this will do it it if we expand it you can see we can tell it where to put its value and at default it is in the Y okay the first one why if I want to put it on Z I can put it on Z in here if I want to put it on X again I can do it like this but if I put it on y x z it will put the W when it is pressed it will put 1 in the Y the first parameter in here right so nope let's just do that for S as well add a modifier of type of Swizzle okay and in here again it I needed to be y x z so it will put 1 in the Y first parameter in here this why whenever it is pressed so no let's just save this whenever we hit W or S it will put one in the Y no you can see if I had s again you can see put 1 in the Y no we want one in the Y whenever we had W and we want minus one in the Y when we hit s on our keyboard how we can do that we can add another modifier in here like this we can have multiple multiple modifier in each action mapping in here right so in here I want to negate it for the S so let's just save everything no if we had Lane here if we had W in here it will put one in the Y and if we hit s on our keyboard it will put -1 in the Y you get that it is so easy to do it no let's just do it for d and a going right and going left how we can do that we can add another one in here and this time I want to use D and whenever we hit D I want X to be one and let's just add another one whenever we hit a on over keyboard I want minus one in the X so how we can do that we can add another modifier in here and negate that value so it will give us minus one so let's just save this and know if we go to our game if we hit D on or keyboard it will give us one in the X and if we hit a on or keyboard it will give us -1 in the X and we have W whenever we had W it will give us 1 into Y and whenever we hit s on or keyboard it will give us -1 in the Y right so with that we can just delete this we know how it works we can right click it right right click on it and split the strike pin now we know what this value will give us right now with that whenever this I move triggered either with w s a d we can add movement Right add movement input so with that first of all I want to go forward how we can do that first of all it needs a Direction so I can use for example where camera and get forward Vector off of that camera for example and put it on the word direction and scale value we know that we want to go forward whenever we hit w we want to go forward and whenever we had W the Y will be one so we can put it there right knowing that if we compile and run over game whenever we had W you can see we go forward whenever we hit s on our keyboard it will go back backward and we can do that for going left and right we can add another movement in here add movement input and this time again let's just use camera and in here we want to get right Vector okay and give it the direction and we can use this x why we want to use x because whenever we hit D on our keyboard it will give us one index and whenever we hit a on or keyword it will give us -1 index so just with that if we compile a run over game WS is working for forward backward but if we had Dr keyword it go right and if he had a on or keyboard it will go to the left now you can see it is a lot cleaner to do it like these than older way to do it let's just create another for another one for jumping so right click in here again go to input and in here create another input action and this one I want to call it Jump Right double click on it to open it and the jump is just a Boolean right so leave it just as that and go to IMC and in here add another mapping and this time choose jump and whenever we hit space on our keyboard we can jump right that's that's it we can just go to here and in here search for jump right and in this jump whenever it is pressed we can jump right jump easy so let's just compile and run if we had a space on our keyboard you can see it is jumping and we can go backward forward and all of that and we can jump as well so that's how easy you can use enhanced input action so that was it guys for this video I hope you like it please please please if you want to help me and you like this video hit that like button and subscribe to my channel it's my honor to have you here thank you thank you thank you very much for watching bye [Music] thank you
Info
Channel: unreal magic
Views: 2,837
Rating: undefined out of 5
Keywords: unreal engine 5, unreal engine 5 tutorial, unreal engine 5 basics, unreal engine 5 beginner, ue 5, ue 5 tutorial, ue 5 basics, ue 5 beginner, unreal engine
Id: keuRn3KFgtM
Channel Id: undefined
Length: 20min 9sec (1209 seconds)
Published: Fri Jan 20 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.