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

af Afrikaans
sq Albanian
am Amharic
ar Arabic Download
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
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
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:06,120 --> 00:00:10,650 Now that we have a starting position set for when we run the game let's go ahead and take a look at 2 00:00:10,650 --> 00:00:14,040 how to move our player along the x and y axis. 3 00:00:14,070 --> 00:00:19,800 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 4 00:00:19,800 --> 00:00:27,330 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 5 00:00:27,330 --> 00:00:29,670 plane as well as the vertical plane. 6 00:00:29,670 --> 00:00:34,400 And if we actually select our player and look at that you'll see here that as I use the move tool and 7 00:00:34,400 --> 00:00:38,870 drag it to the right we're increasing our position on the X in the inspector. 8 00:00:38,970 --> 00:00:41,820 And as I move it to the left we go negative. 9 00:00:41,820 --> 00:00:47,100 Likewise if I go up and down you'll see here that the y value of our position in the inspector is changing 10 00:00:47,100 --> 00:00:49,080 relative to where I'm dragging. 11 00:00:49,110 --> 00:00:54,600 So what we want to do is how do we go ahead and manipulate movement through code. 12 00:00:54,600 --> 00:00:59,400 Obviously we're going to be dealing with our transform and something that's going to affect the positioning. 13 00:00:59,400 --> 00:01:04,720 So very similar to how we can access properties and variables of transform. 14 00:01:04,770 --> 00:01:10,410 We can also perform function calls that will translate or manipulate objects. 15 00:01:10,410 --> 00:01:16,380 Now the process here that I'm doing is called translating and Unity has a default set of methods that 16 00:01:16,380 --> 00:01:21,110 are provided to us to translate objects in order to learn more about this. 17 00:01:21,110 --> 00:01:25,170 We're going to learn how to use and read the scripting API. 18 00:01:25,170 --> 00:01:31,020 The reference manuals and scripting API of unity or how you're going to solve your own problems what's 19 00:01:31,020 --> 00:01:37,410 important to learn is how to research information and how to read documentation. 20 00:01:37,410 --> 00:01:42,330 So what I want you guys to do is go ahead and select your player and look at your transform component. 21 00:01:42,420 --> 00:01:44,370 There's three icons here to the right. 22 00:01:44,370 --> 00:01:49,350 This first icon that has a circle with a question mark in it is the reference manual for the transform 23 00:01:49,350 --> 00:01:50,140 component. 24 00:01:50,220 --> 00:01:56,890 If you click that it's going to open the scripting API you'll see here that I clicked it and now we 25 00:01:56,890 --> 00:02:01,720 are on the transform reference manual which basically would tell you information about the transform 26 00:02:01,720 --> 00:02:02,680 component. 27 00:02:02,680 --> 00:02:06,550 There is information about everything inside of unity. 28 00:02:06,550 --> 00:02:11,820 It's all documented inside of the unity documentation that shifts with the editor. 29 00:02:11,830 --> 00:02:16,960 Now here you'll see the transform component determines the position rotation and scale of each object 30 00:02:16,960 --> 00:02:17,640 in the scene. 31 00:02:17,860 --> 00:02:22,390 Every game object has a transform and that's important to remember every game object has a transform 32 00:02:22,390 --> 00:02:24,690 and every transform is a game object. 33 00:02:24,850 --> 00:02:26,580 You can use those terms interchangeably. 34 00:02:26,590 --> 00:02:30,340 You can also access everything about a game object through the transform. 35 00:02:30,370 --> 00:02:36,130 For example if I wanted this mesh render or this cube filter or the box collider I can get information 36 00:02:36,130 --> 00:02:43,280 about it from the transform and then getting a component which will cover later in working with it. 37 00:02:43,330 --> 00:02:47,510 So let's take a look back at the documentation and what we're going to want to do here is look at the 38 00:02:47,510 --> 00:02:53,890 scripting API which will have code examples for what we can do to the transform so let's type and transform 39 00:02:54,280 --> 00:02:58,000 and you'll see here that we have the position rotation scheme of an object. 40 00:02:58,000 --> 00:03:02,400 Let's select that class and it's gonna give you information about the object. 41 00:03:02,410 --> 00:03:08,170 Now what happens when people are introduced to scripting API is they get so caught up with the code 42 00:03:08,170 --> 00:03:14,650 examples well we're using the scripting API for is for a description of what this function does or method 43 00:03:14,650 --> 00:03:18,200 does and then also the syntax. 44 00:03:18,220 --> 00:03:19,210 That's all we care about. 45 00:03:19,210 --> 00:03:24,100 I don't care what the example is and I don't want to get lost in what their example is. 46 00:03:24,220 --> 00:03:29,550 I just care that I have the syntax correct and I know what this function does. 47 00:03:29,590 --> 00:03:30,560 So let's take a look here. 48 00:03:30,580 --> 00:03:34,750 You'll see that these are some properties which are also like variables and you'll see here that they 49 00:03:34,750 --> 00:03:39,700 have things such as the position of the transform that you can get which we already know as well as 50 00:03:39,700 --> 00:03:41,580 the rotation and then a few others. 51 00:03:41,590 --> 00:03:44,730 And if we scroll down here you'll see that we have public methods and functions. 52 00:03:44,890 --> 00:03:49,780 And that's another thing that's used interchangeably functions versus methods in C sharp that the exact 53 00:03:49,870 --> 00:03:50,890 same. 54 00:03:50,920 --> 00:03:55,690 So if we look here we have some public methods in one of those methods is at the bottom here called 55 00:03:55,690 --> 00:04:01,830 translate and it says moves the transform in the direction in distance of translation. 56 00:04:01,830 --> 00:04:06,760 And if we select that you'll see here that we type out transform that translate. 57 00:04:07,150 --> 00:04:12,120 And if we read the description here it says moves the transform in the direction and distance a translation. 58 00:04:12,250 --> 00:04:16,150 And then if we look at the code example you'll see here they're just using the class that inherits model 59 00:04:16,180 --> 00:04:16,880 behavior. 60 00:04:16,930 --> 00:04:22,780 That's what lets us actually drag and drop the script onto an object they have update and then hear 61 00:04:22,780 --> 00:04:25,980 they're typing in lowercase transform dot translate. 62 00:04:25,990 --> 00:04:31,000 So they're getting a reference to the object the script is on dot translate and then they open a parentheses 63 00:04:31,120 --> 00:04:33,180 and they type in some information. 64 00:04:33,280 --> 00:04:35,250 And this is where typically people get lost. 65 00:04:35,320 --> 00:04:37,180 I don't care what they're doing past this. 66 00:04:37,180 --> 00:04:43,460 I just need to know that hey I have to type transform and then dot translate and you'll see here that 67 00:04:43,460 --> 00:04:48,080 this is also what I should see it should tell me that I can pass in a vector 3 translation so let's 68 00:04:48,080 --> 00:04:53,030 hop back into unity and actually work with this inside the update. 69 00:04:53,060 --> 00:04:55,070 I want to access the object I want to move. 70 00:04:55,130 --> 00:04:55,930 That's our player. 71 00:04:55,940 --> 00:04:58,030 We're on that object already. 72 00:04:58,100 --> 00:05:01,060 So I can access my transform from here. 73 00:05:01,130 --> 00:05:08,240 I can say dot translates and I'm going to open a parentheses just like the documentation said from here. 74 00:05:08,240 --> 00:05:09,530 Let's read out towards it. 75 00:05:09,590 --> 00:05:14,810 It's going to move the transform in the direction and distance of translation and I can pass in a vector 76 00:05:14,810 --> 00:05:16,730 3 translation. 77 00:05:16,940 --> 00:05:19,810 Now for this example I'm going to type in here. 78 00:05:19,910 --> 00:05:22,940 Vector three dot right. 79 00:05:23,140 --> 00:05:25,070 And I'm going to end it with a semicolon. 80 00:05:25,070 --> 00:05:27,080 Every line of code ends with a semicolon. 81 00:05:28,430 --> 00:05:30,090 Let's go ahead and save this. 82 00:05:30,120 --> 00:05:31,520 Hop back into unity. 83 00:05:31,520 --> 00:05:38,770 Unity will compile and then we can go ahead and run the editor and you'll see here that our player is 84 00:05:38,770 --> 00:05:44,290 just going to zoom to the right and you'll notice here in the inspector that the position is constantly 85 00:05:44,290 --> 00:05:49,000 updating very quickly now before we take a look at this. 86 00:05:49,000 --> 00:05:54,240 Let's talk about why I didn't use a new vector three because 100 percent of the time. 87 00:05:54,370 --> 00:06:00,370 What happens if I see a vector three on supposed to use a new vector three. 88 00:06:00,370 --> 00:06:05,520 Well that vector 3.0 right is a predefined template that's provided from unity. 89 00:06:05,590 --> 00:06:09,850 That is the exact equivalent of saying I want to go one unit to the right. 90 00:06:09,940 --> 00:06:13,290 I want to stay where I am on the z axis as well as the y axis. 91 00:06:13,300 --> 00:06:19,750 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 92 00:06:19,750 --> 00:06:26,140 parentheses I save this and this is the exact same thing as typing in vector 3. 93 00:06:26,400 --> 00:06:27,260 Right. 94 00:06:27,270 --> 00:06:31,680 If I wanted to go to the left I could simply just make it a negative value. 95 00:06:31,680 --> 00:06:33,380 So here we go off to the right. 96 00:06:33,480 --> 00:06:34,850 And we're constantly moving. 97 00:06:34,980 --> 00:06:40,470 If I wanted to go left I could just changes to negative one or I could say vector three dot left. 98 00:06:40,590 --> 00:06:47,460 It's going to assume that it is a default setting of one that you're looking for in the next video we'll 99 00:06:47,460 --> 00:06:52,170 take a look at why we move so quickly to the right and what we can do to slow it down. 10696

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