All language subtitles for 6. Moving the Player at the Speed of Sound

af Afrikaans
ak Akan
sq Albanian
am Amharic
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
fa Persian
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

Now that we have a starting position set for when we run the game let's go ahead and take a look at

how to move our player along the x and y axis.

If I select my player and focus in on it I'm going to position our anchors here so that I'm on an x

y plane and what I want to do here is I want to be able to using the WC keys move along the x and y

plane as well as the vertical plane.

And if we actually select our player and look at that you'll see here that as I use the move tool and

drag it to the right we're increasing our position on the X in the inspector.

And as I move it to the left we go negative.

Likewise if I go up and down you'll see here that the y value of our position in the inspector is changing

relative to where I'm dragging.

So what we want to do is how do we go ahead and manipulate movement through code.

Obviously we're going to be dealing with our transform and something that's going to affect the positioning.

So very similar to how we can access properties and variables of transform.

We can also perform function calls that will translate or manipulate objects.

Now the process here that I'm doing is called translating and Unity has a default set of methods that

are provided to us to translate objects in order to learn more about this.

We're going to learn how to use and read the scripting API.

The reference manuals and scripting API of unity or how you're going to solve your own problems what's

important to learn is how to research information and how to read documentation.

So what I want you guys to do is go ahead and select your player and look at your transform component.

There's three icons here to the right.

This first icon that has a circle with a question mark in it is the reference manual for the transform

component.

If you click that it's going to open the scripting API you'll see here that I clicked it and now we

are on the transform reference manual which basically would tell you information about the transform

component.

There is information about everything inside of unity.

It's all documented inside of the unity documentation that shifts with the editor.

Now here you'll see the transform component determines the position rotation and scale of each object

in the scene.

Every game object has a transform and that's important to remember every game object has a transform

and every transform is a game object.

You can use those terms interchangeably.

You can also access everything about a game object through the transform.

For example if I wanted this mesh render or this cube filter or the box collider I can get information

about it from the transform and then getting a component which will cover later in working with it.

So let's take a look back at the documentation and what we're going to want to do here is look at the

scripting API which will have code examples for what we can do to the transform so let's type and transform

and you'll see here that we have the position rotation scheme of an object.

Let's select that class and it's gonna give you information about the object.

Now what happens when people are introduced to scripting API is they get so caught up with the code

examples well we're using the scripting API for is for a description of what this function does or method

does and then also the syntax.

That's all we care about.

I don't care what the example is and I don't want to get lost in what their example is.

I just care that I have the syntax correct and I know what this function does.

So let's take a look here.

You'll see that these are some properties which are also like variables and you'll see here that they

have things such as the position of the transform that you can get which we already know as well as

the rotation and then a few others.

And if we scroll down here you'll see that we have public methods and functions.

And that's another thing that's used interchangeably functions versus methods in C sharp that the exact

same.

So if we look here we have some public methods in one of those methods is at the bottom here called

translate and it says moves the transform in the direction in distance of translation.

And if we select that you'll see here that we type out transform that translate.

And if we read the description here it says moves the transform in the direction and distance a translation.

And then if we look at the code example you'll see here they're just using the class that inherits model

behavior.

That's what lets us actually drag and drop the script onto an object they have update and then hear

they're typing in lowercase transform dot translate.

So they're getting a reference to the object the script is on dot translate and then they open a parentheses

and they type in some information.

And this is where typically people get lost.

I don't care what they're doing past this.

I just need to know that hey I have to type transform and then dot translate and you'll see here that

this is also what I should see it should tell me that I can pass in a vector 3 translation so let's

hop back into unity and actually work with this inside the update.

I want to access the object I want to move.

That's our player.

We're on that object already.

So I can access my transform from here.

I can say dot translates and I'm going to open a parentheses just like the documentation said from here.

Let's read out towards it.

It's going to move the transform in the direction and distance of translation and I can pass in a vector

3 translation.

Now for this example I'm going to type in here.

Vector three dot right.

And I'm going to end it with a semicolon.

Every line of code ends with a semicolon.

Let's go ahead and save this.

Hop back into unity.

Unity will compile and then we can go ahead and run the editor and you'll see here that our player is

just going to zoom to the right and you'll notice here in the inspector that the position is constantly

updating very quickly now before we take a look at this.

Let's talk about why I didn't use a new vector three because 100 percent of the time.

What happens if I see a vector three on supposed to use a new vector three.

Well that vector 3.0 right is a predefined template that's provided from unity.

That is the exact equivalent of saying I want to go one unit to the right.

I want to stay where I am on the z axis as well as the y axis.

So we put 0 4 y 0 4 Z and then I close it off and keep in mind that every open parentheses means a closing

parentheses I save this and this is the exact same thing as typing in vector 3.

Right.

If I wanted to go to the left I could simply just make it a negative value.

So here we go off to the right.

And we're constantly moving.

If I wanted to go left I could just changes to negative one or I could say vector three dot left.

It's going to assume that it is a default setting of one that you're looking for in the next video we'll

take a look at why we move so quickly to the right and what we can do to slow it down.

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