All language subtitles for 007 Setting Up Inputs and Movement[UdemyIran.Com]

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

In this video, we're going to set up the entire input system for our character and very basic movement.

The way inputs are set up.

Drastically changed with Unreal Engine 5.1, but since we are using 5.3, we are already able to use

the Enhanced Input Action System and its active by default.

Let's have a look at the settings first though.

Go to Edit Project Settings and here we can now look for Engine and input.

And you can see here at the top the access and action mappings are now deprecated.

This is the old system we used before 5.1.

However if you scroll down now you can see here under the default classes, the default player input

class is now the enhanced player input.

And we also have the enhanced input component as the default value.

This means that we are using the Enhanced Input Action system, which became the default with Unreal

Engine 5.1.

This system is a little bit complicated and takes some time to set up, but it actually is very powerful

and it gives you many new functions out of the box that we're actually also going to make use of throughout

this course.

Okay, let's set it up.

Now.

We can close out here and we can also close the player.

And in the content drawer we want to go to content and right click to create a new folder and just call

it input.

And in here we want to have another folder called actions.

And the enhanced input system basically has two different asset types.

We can just go into actions here and right click go to input.

And you can see the input action and the input mapping context.

These are the two asset types we're going to use to create this mapping.

First we want to have an input action.

And let's just start with a simple one just called IA for input action underscore jump.

And if you open this up, you can see that there's a couple of settings.

And usually we don't change most of these.

The only important one is the value type.

And you can see by default this is digital bool.

So this basically means that this action is a regular button.

Like maybe the spacebar that can either be pressed or not be pressed.

And that is what a bool means.

Otherwise we have access 1D.

This means it could be either left or right.

For example, it could have a minus one value and a plus one value.

We have access 2D which could be left right up down.

And then we have access 3D which is something more complicated like a motion controller.

So maybe in the smartphone the motion controller or motion controllers for VR games.

And this is what we have to set up for the value type.

But again the jumping is just a very simple button.

It could just be pressed or not.

So this digital bool is fine for here.

Let's go back here and create another input for the movement.

So here again right click input input action IA underscore move and double click to open it up.

And like I just said before if we have something that could have left and right so could have multiple

inputs, we want to use axis 1D.

In our game we can only walk left and right.

We cannot walk up and we cannot walk down.

So we actually don't need the axis 2D.

We just need left and right.

So axis 1D is the correct one here.

Just select it and save and close this down okay.

So now we set up the actions for our jumping and our moving.

And those are the two we want to concentrate on.

Now as we implement the shooting or other actions we can just put them in here as well.

But we also need to bind them now so we can go back to input.

Right click here, go to input.

And now we need the input mapping context.

And we're going to call this IMC underscore action.

For action game.

Double click to open it up.

And I can just move this over here.

And we now need to bind all of the input actions that we created to a button.

So here for the mappings we can just press on plus and need to open this up here and here instead of

none.

We can first start with the jump.

So just select the IA jump.

And we can then open this up here.

And we need to set the button we want.

And I actually want to set this to the spacebar.

But I also want to have this on a different button because spacebar is a little bit hard to use.

Once we also have shooting and other actions implemented so we can just press on.

Plus here again.

And now we have a second input here.

And I like to use K for this.

And yeah I like to use K for jumping and J for shooting.

But the shooting we're going to implement later.

And you can see here we have triggers modifiers, all of these things we don't have to worry about.

Now let's set up the movement as well.

So next mappings.

Click on plus and select the IA move here.

And now we need to have an input for right and an input for left.

So let's start out with the right first.

So click here.

And then on the keyboard press D for right because we want to use the wasD controls.

And here we don't have to change anything for the modifiers triggers.

This is just fine because for an axis mundi, the default direction is right and D is the right direction,

so we don't have to change anything.

Then we press plus again and add a.

So click here, press A on the keyboard for left.

And here we actually do have to change something because A is the left direction which is not the default.

For an axis 1D we have to go to modifiers, click on plus.

And there's a lot of different modifiers here, a lot of them you're not going to use, but the one

you use all the time is negate.

So this means it's going to flip around the input to be left.

So for a and this is all we need to do in the IMC here.

So we can save and exit out.

But this is still not enough.

We just prepared the assets.

But even now again I start the game I still cannot do anything.

We also need to tell this player character, this blueprint to actually use this action mapping.

So we can go to blueprints character.

And again we don't need this for the action chart because the enemies aren't going to use this.

Only the player open up the BP player and on Beginplay, which is either when the game starts or when

this blueprint is being spawned in, we actually want to set up the binding.

Here we want to right click and get controller.

Like this and cast to playercontroller and just connect this.

And this is just a pattern that you have to remember.

And here we can look for subsystem to get enhanced input local player subsystem like this.

And then look for add mapping context and connect this here.

So yeah we get the controller, cast it to a player controller, get the subsystem and then add the

mapping context on it.

And this is just a pattern that you kind of have to remember or just look it up.

And very important here for the mapping context, we have to select our IMC action or nothing is going

to work because you can actually have multiple mapping contexts available at the same time.

And this is why you have the priority.

But for a simple game like this, this is nothing we have to worry about.

And now that this is set up, we can well, we can first delete this action, overlap and tick because

we're not going to use it for now.

And we can just right click and first look for our IA jump.

Right.

This, uh, enhanced action events I a jump and this gives us this whole thing with a triggered action

value.

And you can actually open it up, and it's going to show you much more options.

And there are actually some subtle differences depending on if we use triggered or started.

And for the jump we want to use started.

And from start just drag off and look for jump, which is a pre-made function from Unreal Engine on

the character class.

And now we can just compile and save and go to the map and press play.

And very important.

If I press the button now, nothing happens.

If you want to control the game, you actually have to click inside of the viewport once.

And this is something some beginners forget.

And then they think that the input mapping doesn't work.

Very important.

Click into the viewport.

And now I can press jump and you can see the character jumps.

This is still very floaty and it feels very bad, but it actually recognizes our input and executes

the action we set.

And we want to go here and from canceled, we actually want to stop jumping.

And this becomes very important once we implement the hold jump.

So we can hold to jump longer.

But we already want to set this up because this is the basic setup for jumping.

Let's now set up the IA move so we can go down here.

Now open up some space here and right click look for IA underscore move which is our enhanced input

action event.

And again we can open this up to get all of the options for moving though we don't want to use started

because started only happens when we press the button.

But movement should also happen while we keep holding the button.

So here we actually want to use triggered.

And for this we can again use a function that is available on the character.

So from triggered we can just look for add movement input here.

Input add movement input.

Very simple.

And here for the scale value we just use the action value.

And this is like I said before the float 1D.

So this could either be minus one for left or one for right or zero for nothing on a keyboard.

But if you use a gamepad, it could also be something like 0.2 if you just tilt the stick slightly,

or if you tilt the stick slightly to the left, maybe 0.5 and -0.5 and things like that.

So we can just get this axis value and put it into the scale value.

But very important, we also need to set the world direction because otherwise it doesn't know like

which direction we want to walk into.

And since we make a simple 2D game, we just have to put in one for X because this is the left and right

direction in the world, we can go to the map and you can see the player start here right.

And you can see this red axis.

So this is the x axis.

And we want the character to only be available to walk here left and right.

We don't want to walk up and down right.

So this is why we just put the 1.0 for x and have zero on y and zero on z.

And this is all we need for this.

So we can just compile and save.

Go to the map again click into the viewport.

Very important.

And now click on A for left D for right.

And yeah we can move around.

We can jump.

We can jump while moving as well.

And this is how we set this up.

But of course we want the character to turn into the direction we're walking.

And this is actually also very easy to set up.

And we only need to worry about turning left and right while we are using an input, right?

So we just want to check what's the last input, a right input or a left input and then turn the character

around depending on that.

And for deciding if we turn the character left or right, we simply have to check for this action value,

and we have to check if it is greater or equal than zero.

And this would mean yes, we want to go right, and if this is not the case, then we want to go left.

But how do we do that.

So we can get controller.

And this is specific for players only.

This does not work on MPC.

So for the NPCs we're going to use a different method later.

And here we can just set control rotation.

Like this and connect.

And we then want to use this.

Uh, well, we could use a branch.

Right.

So here we can use a branch, which is like a true or false statement.

Right.

So we could have true and go into certain direction and on false go in a different direction.

But there's actually a cleaner way of doing this.

We can just drag off here from the new rotation and select and get the utility select.

And this basically if we connect here to the wild card, uh lets us make a shortcut so we don't have

to use a branch.

We can simply put the values here.

And well both methods are fine, but I just prefer this one personally.

And we can then decide which value we want to use if we're, uh, going to the right and which value

we want to use if we go to the left.

So here we can just drag off and make rotator.

All the way at the bottom.

And well, if we are looking to the right, we don't have to change the rotation.

000 is the default, so this is fine, but if we want to go to the left, we can just control C control

V copy and paste this.

We want to change the yaw to 180 to turn in the other direction.

Right.

So again we just check for the action value if the last input was bigger or equal than zero.

This means we are going to the right.

This means we also want to turn towards the right.

If this is not the case, we're going towards the left.

We want to turn towards the left and we execute this on the set.

Control rotation can just compile and save and check this out.

I go right, the character looks right, I go left, the character flips around.

So this is fine.

The character flips around, but the camera also flips around, which is something we don't want.

And there's actually an easy fix for this.

But first, we confirmed that this works properly.

So we can just select all of these, select these, hold shift, select the other ones and we can just

collapse them.

So here we can just right click one of these and collapse to function and just call it update rotation.

I just had a typo update rotation.

And drag this up here.

Double click the line here to create a reroute node.

Yeah, just keep it clean.

And we don't want this to be called a we want this to be called direction.

Well, direction in the sense of its if its minus its left if its plus its right.

And yeah.

So all of the stuff is still in here.

But we just finished this.

We never have to worry about this again.

This is completed.

So we just collapse it into a function.

It's also available on the left side here now.

And this just makes it look cleaner and more manageable.

But let's now take care of the camera so we can go to the viewport.

We can look at the spring arm.

And we want the spring arm to basically ignore the rotation of the capsule component and of the actor

as a whole.

And this is actually very easy to do.

We can just go to the transform rotation and set this from relative to world, which will then be shown

as absolute rotation.

And this just means it is always going to keep this rotation.

It's going to ignore what the capsule, what the actor and everything else does.

So just compile and save.

Go back I go right, it's fine, I go left.

It is also fine.

I'm turning around, but the camera is ignoring whatever the character is doing.

And this is the basic setup for our input system.

So congrats on coming this far.

This is a little bit hard to wrap your head around at first, but you're going to use this in all of

your projects.

You're going to get more used to it.

You're going to start to understand the amazing features this gives us, even if it's a little bit of

a pain to set up in the first place.

However, you also notice that even if we can walk around and jump, it doesn't really look that way

because we're just playing the idle animation on the character.

So the next chapter is going to be very interesting, because we're going to use paper 3D to set up

the animation tree to make the character animate, depending on if we're walking, if we're jumping,

if we're falling.

So please look forward to that lesson.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.