Unity Input System: New Input Tutorial (A Quickstart Guide)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right and today's tutorial we're going to be making this simple top-down controller using the new unity input system mostly because the old input system is becoming archaic old decrepit and it's no longer gonna be useful going into the future because well you know unity is gonna stop supporting it at some point without further ado let's get into it so let's start with a whole bunch of nothing let's make sure that you guys are using the same version of unity that I am using because that will stop a lot of bugs from occurring in the future and plus I like uniformity so let's go ahead and make sure that you guys are using twenty twenty point one point something it doesn't matter whether it's still the beta or not if you guys have something that is a more complete final version of unity that is cool go ahead and use that one instead it's probably better than my version because I am going all sorts of deep into this beta let's go ahead and make a new project if you left click on project hit new we can go ahead and make it inside of here we're gonna go ahead and just stick with the 3d when I can go ahead and you see Universal render pipeline or a high definition render pipeline because we mostly don't need to we're gonna go ahead and go top-down doesn't matter what you name it I'm sending mine top-down so it's super easy and then it will get started though in this tutorial we are not gonna be utilizing anything from the asset store so it's gonna be completely built from within unity system so that it is accessible to everybody that watches this tutorial and I'm gonna try to like bus right on through the very simple basic things like for instance I'm gonna just make a floor make a capsule for the character if you don't understand those things I recommend you go into a more beginner friendly tutorial I actually have some available here online you can go into my platformer series and I'll explain the difference between game objects and components and stuff but if those words are just completely foreign to you then this tutorial might be a little beyond your grasp I'll leave a link in the description below for the platformer tutorial anyways go ahead and click into your scene view you can go ahead and make a new object inside a bit for the floor we're gonna just get a simple basic set up here with the floor capsule for the player those go into the 3d objects let's go ahead and make a plane for the floor if we hit the R key on our keyboard it will actually bring up your scaling tool you can go ahead and just expand things on now we want to go in the x-axis which is always red and the z axis which is always blue and if you scroll out it'll actually scale out way faster because it's a relative to the size of the screen so if I scale out now it just goes whoosh all the way up to 200 something and all the way up to 200 something good now let's go ahead and rename this to floor you can go ahead and do this into multiple ways if you just left-click on plane and just wait it'll automatically bring up the rename a lot of times I actually like to have more control for this and push my f2 key on whatever I have selected so if I have Brown selected I can hit f2 and I can rename to the floor for instance I use ctrl s to save my sample scene really quick I like to keep my things saved as I'm going so now we're gonna right click on sample scene and we're gonna go into game object go into 3d object then we go down to where it says capsule again and that'll bring our capsule right back on up visit our W button or we can click up here on these arrows so that we bring back our move tool then by moving this move tool on up we can get about two roundabouts place where we are above the floor now you'll see it's about one right now it's blending right into the floor we don't want that we want it to stick out from the floor goes to the top-down shooter so if we go ahead and right-click it create we won't make a new material on here we're gonna make it a player material we're gonna go ahead and select the albedo over here where this white spot is and then we're gonna go over to where the blue is and we're gonna saturate it on up and the head with this square and that will give us a new or nicer color I'm gonna make mine actually a lighter blue so six out a little bit more and we're gonna just drag it right over on the player now the shadows are a little bit too powerful inside the system so let's go ahead and get rid of that too we're gonna go over to our directional light right left click on to it then we can mess with the real-time shadows over here inside this so let's go ahead and just like a lower dizon down because they are way too strong you can leave them on if you want I might even turn mine completely off just because it's a top-down shooter and I'd rather have it so that people can tell what's happening versus having it so that uh we don't see what's going on at all so now that we have the shadows turned off we can start to see what's going on on here let's select our player again let's actually rename this guy so once again just left click on capsule and then we can just rename them to player and we have a problem because our character is awfully round and so we have no idea where he's facing now the let's have a top-down shooters when you're looking down at this capsule you need something to be pointing out from the front of him some kind of gun like object so that we know where we're shooting that brings up the question where is forward and inside of unity that is always the direction that the blue arrow is pointing at in other words that is where does Z axis is pointing at and so in this case let's go ahead and set an object to that location so let's right-click on our player let's hit create 3d object and let's go ahead and make a new cube inside of him and with that cube we will actually resize it to be the correct size to be somewhat of a gun like object pointing from it's gotta be more like a 2x4 but that's completely fine so let's go ahead and hit our R key that may bring up our scale scale down to the x-axis a in other words this red bar right here will actually like give us the x axis and we're gonna scale down the Y as well to give us more of a 2x4 appearance and we're gonna bring up our move tool through the W key and move our arm forward and that should bring up a pretty good 2x4 for us let's go ahead and use our scale to a little bit more to make a little bit longer because who doesn't want a longer object sticking out from okay so let's move it on forward a little bit and let's make another new material for that we wanted to stick out from the player and look like a different object of some kind so let's make another new material right-click it create him material let's go ahead and make it by 4 or whatever you want name it it doesn't have to be the same way I'm doing it I'm just amusing myself let's make it red or something because why not there we go we now have a red 2x4 and our blue fella over here and we're looking pretty good now let's get into the meat and potatoes and actually start talking about the new unity input system there are some great benefits to an inch really cool but the way that you get inside is completely different as well so if you left-click on the window and you go down to where it says package manager you can go ahead and click on where it says in project up here then let's go ahead and go into where it says saw packages in project up here on the top of the screen let's hit all instead and that will bring up all of our projects you want go down to where it says input and then you'll see input system you want to install it into this it will eventually start importing but the screen doesn't pop up right away don't worry just wait for it now it brings up this morning just hit YES on it and then we have the input system in our game only problem is it won't currently work because we hit YES on that warning so go ahead and exit out and reboot your whole thing really fast after you have rebooted to your game now we can go ahead and start actually doing things so right click over here where we made our materials and go to create and at the bottom of everything there should be something called input actions and if you're using a later version of unity it might not be in the same order but hopefully you're using the same version as me because I told you to at the beginning of this video don't think I'm not still thinking though I know there's gonna be some rebels amongst you and so you can go down to where it says input actions on here and then we're gonna you could make this named whatever it really does not even make a difference whatever and if you double-click on whatever at this point it'll bring up this thing it'll be a smaller window and your guys just case I haven't maximized for it to take of you guys and I'm not gonna go over every option inside this but this is where you make the controls so the reason why I'm not gonna go over every option is because if I did this would be like a 3-hour video is you input systems pretty intense this is gonna be more of a QuickStart guide so if you go over to where it says action actually hit this plus button then you can just make this action at be whatever you want downs these different action maps will change up the controls if you want so if you have one of those games where I like the game is both a platformer and a top-down game depending on like what they're doing you can have like a platformer or action map and a top-down action map and then when they're in platformer mode you can switch the platformer and then when they're in top download you switch top-down that type of thing is possible with this new system you know different action maps now action maps are the groups of actions that you need to keep track of and these actions trigger different functions inside of your scripts and stuff so that's gonna make more sense as we go along but you can think of each one these actions as being similar to like the entirety of what the axes were before so if I click on this one right here I can rename it same way that we rename things before you can left-click and just wait and don't happen if you don't have a selected person you just left-click it nothing will happen you know the left-click and let's look again and then wait for it to be able to rename we're just gonna make something called movement at first right now we're going to add something to move Minotaur it houses binding down there below we're not going to use that one we're going to go ahead and hit this plus button and we're gonna actually set it up so we're gonna add a 2d vector composites you'll see why I use the 2d vector here in a second and I'm gonna rename this right away because it allows me to right away I'm gonna say WASD and you can see there we haven't up a down a left and a right built into this now first off we're gonna get rid of this no binding thing on top because it's useless to us after this point and we're gonna go left click on the up right here and we're gonna set this to a key by left clicking where it says path over here then you can go ahead and start to search right off the bat so if we start writing W for our up key you're gonna see W keyboard pop up and then go down through this whole thing now sometimes some of the stuff won't pop up right away so if I look up S for instance it doesn't pop up right way so I look up S key it does pop up right away then you can just kind of do the same thing for everything else there we go just like that we have all of our key set what's really cool about this new system is that you can hit the plus button again you can add an ER 2d composite and I can say arrows and then just like that I can say up arrow down arrow again just left clicking on what I want to change and then left clicking on path and then just writing in what I want and then I can just hit enter to put it on there automatically and just like that any set of these keys now will trigger the movement action now now that we got a link this movement action up with our actual script in order for something that actually happened from it though there's right now nothing's happening nothing's watching this nothing's listening to this nothing cares about this thing's opinions yet we need something to care about this thing's opinions so we're gonna make something care first off we need to save this things if we accidentally bring up this thing that says you should save this basically and we can hit save but instead of that I'm gonna hit cancel we're gonna click this autosave so that things are just to automatically save every time we do something inside of here so we don't have to worry about that from now on and when I hit exit that little screen won't pop up anymore now if we go over to our player we're gonna actually start to make it so this thing can actually listen in on stuff but before that we need to get set up we don't have nothing set up yet our main camera's not set up nothing set up so let's go over to our main camera is we're gonna make it a child of our player and we're gonna actually zero in everything in terms of position and rotation for it then we're gonna take the Y and we're gonna drag it on up we're gonna take our rotation and we're gonna take the X on here we're gonna rotate it until it looks like it's facing down at the player it should be about 90 degrees and then we can just change this in ninety the reason why I show you that we pull that axis first it's kind of good to get about where you want it first just to remember just to make sure that you actually want it at ninety degrees and not at something else then you want to drag it to the height that you wanted at and I don't know where that's gonna be so maybe we should make it somewhere around like let's say 25 by the looks of it the players a little bit small on it but if I hit play to kind of test it out to kind of get a look at it it doesn't look too bad so we can track this camera back out because we don't want it to just be a child of the player right we don't want to rotate with the player and do things like that and we're gonna make it quick script on the main camera now we're gonna call it camera Hall oh that's good and it should pop up on here we double click on that and open up our visual studio or whatever you guys are using the script I'm gonna go really quick through this game follow script it's not the point of this so we're gonna make a public transform target and then inside of private Boyd Lake update which is similar to the other updates that you guys have used before and you probably even use late update if you're follow along in this tutorial but it just happens after all the other updates and that's where you want your camera to update and then you want to set your transform to this thing so if target does not equal null this is just to make sure that we actually have a target set before we do this otherwise we'll get a bug off of this right it targets us on equal null then we want to set our transform position we wanted to be equivalent to a new vector3 the reason why we're doing a new vector3 instead of just setting it to our targets position is because we actually want to keep our own Y position in this case so we say at target dot dot X and then we want to say transform dot position dot Y and we want to have target position dot Z and just like that we've created a very simple camera follow script inside of here and if we go back inside the game really fast we can take our player over here and then we can drag it right over to the target and just like that we have a simple camera follow scripts set to there and this thing is now our stalker which is exactly what we kind of wanted in this case go ahead and hit control s and save our sample scene once again and then we can get actually into the actual input programming sort of kinda maybe so if we add a component we want to add a rigidbody to our player so left click on player your on going to add component and write rigidbody and then we're gonna add that into our guy we're gonna make the mass somewhere around 50 because that's cool and right away that you want to make sure that your constraints are on because if we move this guy around he's gonna flip flop around because right now he can rotate in all sorts of different ways so if you click on to your rotation you remember that red is X and blue is Z and greenish is y and if you don't actually remember that just kind of test it out and see what's going on so your transform up at the top right because you'll actually see like what's actually rotating in this case the X in this case we want to freeze the rotation on both X and Z and that will make this so that he can only rotate on Y which is what we want inside of a top-down shooter cuz we want him to be able to go whoosh and like you know rotate like this right and point out different things and just like that we have that set up and now let's go ahead and add another component and let's make it so that we actually get some input so like I said before this player right now is being a really bad boyfriend to our whole input system it's he just not isn't listen he doesn't care what whatever says and it's just not very nice of him so let's go ahead and try to start typing in player input and that'll bring up this little thingy right here and this is like our player suddenly got a change of heart he went through therapy and now he's a good boyfriend so we can go ahead and cook this oh right here he's like oh you know what I'm married to whatever and now he'll start listening to her and now we can actually start listening and see what's going on now there's multiple different ways that we can do this though that's all controlled through this behavior here everything else in the middle by the way you just kind of ignore for now cuz we're not gonna be messing with that at all there are four different ways that we can actually send the information that we're hearing from whatever who are scripts here but we're gonna start off with send messages cuz it's kind of default but I'm gonna show you why I do not like it then we're gonna switch to unity events afterwards which is the same thing that the UI system uses and I think that you're gonna find like I found that it works a lot better for everything so let's add a component and let's make our new own script finally at last and called player controller or something like that and double click on player controller and open it up inside of Visual Studio you can get rid of everything that's inside the brackets right there and start from scratch because that's what we like to do and we will get started before we even get started we have to add a namespace up here at the top in order to actually be able to use anything inside the new input system so we'll say using unity engine dot input system and that will give us access to the new scripts now if we go back into unity we can kind of see what kind of messages are being sent through the system here and you see on movement and if I open up whatever and I make a new action on here you see right now the on movement matches up with movement if I make something new inside of here something new right and then we exit out of it because the autosave is on and that's amazing and I click back on the player and we go back over there you see on something new is now there so in other words we have to make functions that match up with these things inside of here so if we make a match up public void on movement and then we go ahead and hit input value which is a new thing that's contained inside of the input system right there you'll see it turned white instead that gray and then we're gonna go ahead and take in a value you can name that whatever you want and then we're gonna go ahead and make something happen on here but first we're just gonna say debug blog and we're gonna go ahead and say it works in other words our keys are hid and we know that it's working so let's go back into unity just to kind of show that that it is working really quick and you can see it works is popping up on the bottom left of my screen really awesome our input system is already kind of working here now the problem is it doesn't actually use anything out there but it passes in that value right there right and that value can actually give us some information so let's get information from that and let's actually get a vector2 as a rule of thumb there's a couple different things that you use inside of this new system one is get and other ones called read value and it depends on what variable that you're using it if you don't know I'm talking about yet don't worry about it it'll make more sense as we go along vector to input vector so I'm making this little function up here at the top and we're gonna make it a new vector to zero zero this is gonna know what kind of input that we have going through our system and we're gonna set our input vector equivalent to that value that we just got and then we want to use it right away and actually tell people what's going on in here so let's actually say the X that we're getting from that is equivalent to input vector dot X dot to string and we're gonna add the Y over here in the same way input vector dot y dot to string and I'm gonna explain this all in a second here so don't worry if you're completely lost but I just want to show you guys what's actually going on and what why it causes us a problem so if I go ahead and do some movements on here you'll see that it's giving me this normalized input another and if you don't know when or malaises it makes it so that diagonal movements are are being inputted correctly when you're holding down two keys so it gives me normalized input on the bottom left of the screen but it never gives me zero zero when I release all the keys and that's the problem I have with using send message it doesn't send a message when you're having 0 0 go through the system which is a problem and now if I open up whatever really quick and we can get rid of something new because we're not using it at all and delete that if I opened up whatever and then I go over to the WASD you'll see that digital normalizes over here on the right which shows why we're getting normalized input so it saves you a step by using the system you automatically get digital normalized input the problem is we're never getting 0 0 so we'll never stop moving right that's that's an issue it always thinks that where you have input going down if I scroll through this you never see 0 0 so let's go ahead and figure out how to fix that problem so if we go back into unity we can use the other system instead but first let's explain what really happened here when player input here's what's going on from our good ol whatever over here because it's linked into our actions right here it sends a message because that's what our behavior is when it happens so it goes oh whatever something's going on we have that cue push that that whatever is in - you know so she's like okay movements happening guys and here's what's going on with movement so behavior goes okay I'm sending that message over to anything that's inside of me and it goes player controller has on movement so let's go ahead and make something happen on that so on movement happens at this point right now on movement goes okay so they told me this information right here and on movement is happening and so it goes okay first off let's take my input vector and set it equivalent to this to the value and I'll get something out of that value now if I go over into here you'll see that the input value is its own class so we need to use a function inside of that class to make it into something that's useful for us in other words a vector two which holds like you know the different types of input and stuff that's why we go through this thought process and that's why this debug log works it works just like normal input does from here on forward I hope that kind of makes sense again I'll really explain it here in a minute because I want to redo this we're gonna actually switch it over to the unity event system instead now to kind of fix our bug where we never have it so the input is going to 0 0 because the unity event system does fix that I don't know if this is by design or if they just messed this up but we want this to work so we're gonna go invoke unity event instead and right now we don't have an event to hook up into the system because this thing is set up wrong now one of the benefits this is what we can name this whatever we want so if I named it whatever we want for instance it'll work still now the downside to this system is that we need to put a completely different variable inside of here it doesn't in take the same information and it's a little bit Messier inside of here so if we can do input action and then we go dot callback contacts right then we can go contacts instead and this will be something a little bit different now the problem is that callback contacts so in this case contacts doesn't have the get instead we have to do read value and so so right now this is doing exactly the same thing that we were doing before right except for it's not hooked up in that way right now this thing doesn't know what it's supposed to tell the behavior to because we're invoking an event so if we go down here to events and then we go down to the player on here right and then we can see that movements on here still because it's named after this right here movement right so we go over to the player and we open up our bentham we open up our player and then we want to go ahead and hit Plus on movement right here and then we want to drag over the player object so that it's on top of here so that it can read the different functions on that player we can open this bad boy up then we're going to go down to where it says player controller because that's where we built this and you're gonna see whatever we want is up there on top because it's whatever we want and it has everything built into it that we need and then if we go ahead and hit the play button once again we have input working but when I let go of a key 0 0 pops up so we now have our input system working correctly which is amazing guys so we can go ahead and go back to our script in races hold debug log we're gonna go down here and say private Boyd fixed update well we actually need our rigidbody first I haven't done that yeah private private rigidbody RB and then we'll go down here and say private Boyd start and then we're gonna say RB is equivalent to get component rigidbody [Music] and that right there will give us our rigidbody to use we're also gonna need something that lets us know what kind of how fast we're gonna be moving here so if we go private float and then we'll go ahead and say move speed and let's go ahead and make it something like 150 F I guess is probably good enough for now we're not actually gonna use both axes that we we have available to us in the system because we only really want to be able to move forward towards whatever we're pointing towards or backwards so we're gonna go ahead and say RB that velocity it's equivalent to transform dot forward which is whatever location that blue arrow is pointed to we want to multiply that entire vector 3 based on the input that we have so if it's zero this will all become zero and we won't move anywhere our velocity will be zero we will move up down nothing but if we're multiplying this by a number then we will actually move towards that number so in this case we want to multiply it by whatever our input is like by one will be moving forward if we multiply by a negative one will be moving backward because we're pointing forward on this right so if we multiply by negative one will become negative and therefore backwards hope that makes sense so we're gonna take our input vector and the y is actually equivalent to our W and our s in this case right our forward and our backwards then we're gonna multiply that by our move speed because we don't want to just move that one or a negative one we wanted to move based on a much faster speed and of course if this is zero then a V multiplied by zero even if it's two things becomes zero so we'll be okay we still won't move so theoretically this should work now so if we go ahead and play this we'll test multiple things it'll also test to see if our camera controller is working I'm actually gonna minimize it so that we can see our transform because it's not gonna look like we're moving because this flourish is all one big giant sameness inside of this world so but if we look over here on the transform and I start moving you're gonna see my z change positions which is great on there so we are now moving our inputs completely working that is phenomenal W and s is working we have a game sort of kind of not really but let's keep on working on it and maybe we will so the last thing that I'm really gonna try to work on here is making so that our character is pointing at our house but before that let's make some contacts inside this game we want to make it so that there's some different different things for our character move around and stuff so that we know that we're actually moving so if we go ahead and right-click on our side of the sample scene a game and go to game object we create a new 3d object we make a new cube and we'll kind of just like move it around and scale it a bit you guys can do this however you want so if you take the X like this move that around and maybe move the Y like so and we'll make kind of like a little bit of walls and stuff inside of this I want to I'm pretty thick like that so that we can actually like you know really see it from the top-down view and then we're gonna right-click and make a new material inside of this so we'll go create material and I did this by right-clicking down here and my bottom assets right I'll just make these like the walls right we just wanted to be any kind of color that kind of sticks out from the floor so we can make it a green color for instance and that's fine and just select it on there and then we select this object again ctrl D we're gonna hit W for our move tool then we can move it on over then of course I can hit control D like so and move it on over like this control D move it on over just to kind of create some context for where we're at right then if I hit play again you see if I move forward and backwards you can see like the how fast were actually moving inside of this game at this point right that would give us everything that we need to kind of finish up here so let's actually finish this bad boy up so first thing first I'm assuming that you guys know how like break ass and stop work but the big thing is that in order to do a rake ass and define our direction of our mouse and everything is that we actually had to have our Mouse's position which in the old system you just said input dot Mouse position but if we're use the new system we kind of want to do it in a complete way in other words we want to be pretty uniform and using it everywhere because eventually it's got the old systems and go away so in the new system you actually can select your mouse to a new Mouse class so if we go Mouse then go Mouse dot current on here will actually get the current Mouse now we can even make it so that there's a failsafe built in so if Mouse equals equals null in other words there is no mouse then we can say something like debug log there is no mouse and we'll do all capital letters cuz it's important and then we'll just say return right and return will negate this entire function and then we'll see that the that this is no longer working and then just movement won't occur at all and that'll be good because out fix some bugs and so this is kind of one of the powerful new things that are inside the systems that we can tell what Mouse is plugged in which mouse is current we can met we can move around what control schemes that were based on once plugged in we can do some things like that through this scripting right here but for now we're gonna just do that little thing right there I just kind of want to show you that it is in existence and then from there we can actually start to figure out where our Mouse's location is and point our character towards our mouse now what I like to do when I'm trying to do something like this and is multiple steps is I like to get the last step built in first so that I kind of know where we're going and in this case we're gonna take our rigidbody and we want to move his rotation right so be used to move rotation we can kind of see what's gonna end up happening down here right they were gonna just go ahead and write new quaternion for now because it's taking it that's what says it takes it says it takes a quaternion we're gonna say new quaternion for now and we're just gonna leave that blank just so that we don't have an error so now I know where we're ending up and I know I need to replace this quaternion with the actual rotation that we won't be facing them so the whole point of everything else that we do above this is define that rotation so the first problem here is that we need to actually get our Mouse's position out as you guys might already know the mouse is actual position isn't where you think it would be it's like when you actually get it from there you're gonna read it Mouse top position right and that Mouse top position for one thing it's messed up because it doesn't actually it's not actually a vector - like it would normally be inside the input so you have to read the value you guys see this as a common theme inside this new input systems that you always have to read the value from a class right and there is no nothing with triangles inside of this one so you're just gonna do it automatically you just go ahead and hit read value and this is gonna be it the thing is I've screen space so we want to actually transform this mouse top position dobry value and but the thing is we want to use this position right here to actually get the spot on the floor that we're going towards we don't want to actually get the position of the mouse on the screen we want to get the position of the ground where the mouse is at we don't want this position of this mouse on the screen which is what we would get from that we want the position of the floor where the mouse is touching right now so we want like this spot right here on the ground in this case or this spot on the wall so we want our player to be facing those locations so that's what we'll actually be trying to get here by using a rake through that spot so we used to stop revalue right and we're gonna do a ray cast on here instead so if we go camera dot mean dot screen 22 ray we can take this position of our mouse mouse that position that read value and we can actually do a ray caster that so we're gonna actually have to set it up an array of course and just like that we have that rate going out then it's just a simple physics out ray cast that we normally would use in this type of situation and you can go ahead and select whatever type of recast you like to use we're gonna shoot off the Ray we're gonna do out and we want to have our hit info go into something so we're gonna go ray casts hit and we're gonna go ahead and call it hit and just have it on there and then we'll just out hit on there and then we're gonna go over to let's see we want to actually have a max distance at least so let's make it like 350 out for that case now the thing is like you only want to do this whole moving of the rotation thing if this thing actually hits something so if it doesn't hit anything let's go ahead and make an if statement on this and so that will only do this stuff this right here if that hit something so welcome to control X and there we go now we'll only switch this move rotation based off that now from there we can use this hits hit info right here which again we don't even want to do anything with hit unless it actually hit something so we're only gonna do hit within these brackets right here and then we can use that hit they actually get a point of where we hit so we're gonna take our position so we're gonna get a new direction here a vector3 direction and we're going to take the location of where we hit hit that point which is a vector 3 and then we're going to subtract the location of where we're at so transform dot position like so and that will give us the location that we're moving towards now we could normalize this and then everything will function the same and it's good practice just to normalize everything in the first place but in this case because we're gonna be using a eternium direction we don't really need to so Q direction in this case that we can go p-- attorney in the actual class here and we're gonna say dot look rotation now look rotation has two different ways of going about it I can do it forward in upwards but we only need to forward because we're actually doing a top-down things and we only want to control where the blue arrow is pointing towards so we're gonna go ahead and go a new vector3 here because we want to control this a somewhat and we want to feed in directs we want to feed them zero for the Y and then third Z for the other direction there I found better results just from feeding in zero here I mean it still kind of works from the other ways but we don't want to really mess with the Y too much because you'll see that he kind of like will point a gun downwards and upwards if you're pointing at something that's not directly on the ground level if you don't have zero on here is why I did that and then instead of doing new quaternion on here we're actually gonna feed in our cuter here and with all that done we should now rotate towards wherever our mouse is pointing all with the new mouse system inside of here so let's go back to our game is hit play again we're looking towards it and as you can see wow we are super fast but we're look we move towards these different walls we can move backwards forwards around when we stop moving we stop moving which is pretty cool you know like if I look like all my movements so we're looking pretty good here guys we got this move in and that's really it for this tutorial right here I hope that you really liked a tutorial please leave me a like a subscribe comments down below I have a patreon page now I just started it recently it's in my description below but despite everything I'm so thankful for all of your time like it's it really means a lot to me that you guys spend your time with me and like you know watch my tutorials and everything it's really nice to be in this with other people keep on working guys happy game development have a great day bye
Info
Channel: Alvin Roe
Views: 17,073
Rating: undefined out of 5
Keywords: unity input system, unity input system 2020, unity input system keyboard, unity input system mouse, unity input system tutorial, new unity input system, new input system, unity 2019 input system, unity new input system tutorial, input manager unity, unity 2019.3, unity technologies, player input unity, game dev, game development, game engine, getting started, input system, unity input, unity tutorial, player input, unity input tutorial, input system preview unity
Id: cOy9JZXlGQ0
Channel Id: undefined
Length: 34min 48sec (2088 seconds)
Published: Fri Apr 03 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.