All language subtitles for 5. Camera move control

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
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
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

So now we're going to work on our first script and we're going to get our camera to start moving.

This is one of the reasons why we imported a package called Joystick Pack.

OK, so for DoubleClick and Joystick Pack does have some documentation which you are free to read to

explain to us to use this.

We do have a number of prefabs.

OK, so the one that we want to go with is a fixed joystick.

The difference between these dynamic joystick will appear wherever you press your finger floatin joystick

can float anywhere as well.

And the variable joystick obviously is variable.

You can change those items fixed will always stay in the same position, or at least that's as far.

That's what I understood when I read the documentation.

So in order to work with a fixed joystick, we need it to be a UI element or a user interface.

All of your UI elements are going to fit on the canvas.

So we need to create ourselves a canvas.

So let's click game object UI and then you canvas.

As soon as you do that, you get cumbersome to event system.

The event system is basically what is going to detect your touchin of the items and interacting with

those elements using the standalone input module.

OK, if you ever wanted to switch on the view UI elements of just basically uncheck that you can no

longer interact with your canvas.

OK, well, I'm quite happy to do so and so canvas.

The first thing that we notice about it is that the randomly is screen space overlay.

So that basically means it will always be exactly the same and render over everything.

If you did change that to screen space camera basically means it's only available on certain camera.

So you could switch cameras in the UI and disappear or worldspace means you could actually have a canvas

inside of the world that takes on the 3D location.

That's useful.

For example, if you wanted like a health bar over your characters, work in the to stick with screen

space overlay and targets play.

Always make sure it's display one.

That's what we're using up here if we want to display, too.

That's what we show in 3D.

It's literally nothing rendering there.

So let's make sure it stays on display.

One additional shaded channels.

Yeah.

Just leave it.

Nothing.

Now, very importantly, I kambah scalar at the moment, UI scale mode is constant pixel size.

So even though this is 12, Racheli, 720, if we create a UI and get it all lined up and then somebody

has got a mobile device that's capable of running a full three thousand eight hundred and sixty pixels.

And what's going to happen is UUA is going to be absolutely tiny.

Right.

So small, you're not being able to interact with it.

So I'm going to change this to scale with screen size.

And I'm going to use our dimensions as a default reference resolution.

So 12, 18 by 720.

So that's where it's going to start out with.

Now, if somebody's screen is way bigger than that, what he's going to do, it's actually going to

scale up this UI.

So it fits the screen size.

Or for some reason, if somebody has got like a really little mobile device, he's going to actually

scale down as well.

Now, on the mobile devices, we do want a much width or height.

And we probably want to match the height actually on this one.

And and our reference pixels per unit, it's about 100, which is fine graphics.

Recasner basically means that we can actually touch things on the canvas.

All right.

And so what we're now going to do is we're going to take a fixed joystick, click and drag onto the

canvas, and then we go, all right.

Now, got this.

And we can move this around in 3D space by using a pulse X, pulse y.

So I'm just going to kind of click and drag over to the left hand side, click and drag down into the

bottom left hand corner.

Now, what I would recommend doing at this moment in time is going over to your simulator, rotate it

loops like this, making sure it looks OK on the screen.

This is what it currently will look like.

Also recommend checking it out and a lot of different devices as well.

So if it's, for example, an iPad Fifth-Generation, this is what it would look like.

As you can see, with cutting out little bits of the side of the screen, the iPod.

And if it's an iPod pro Apple, iPhone 11, we've got a little bit more of the screen there.

We've also got this little bubble there as well.

But we can definitely still interact with this iPhone six, etc. So it's a Google Pixel three.

It's going to show you what this is going to look like.

And it's pretty accurate representation as well.

So just go through quite a few of them and see what they look like, make sure that it's not excluded

in any way or it's halfway through the screen or something.

Yeah.

OK.

That's an interesting screen size.

That's the very last one as well.

OK.

Yes, I'm quite happy with that.

So I'm going to go back to my Samsung Galaxy seven.

And what I want to do is I want to make sure that this item is always targeted to the bottom left hand

corner can do so by using these anchors, and it's automatically done that for me.

Which bottom left?

If I did top right, it would always be anchored to the top right of the screen.

But bottom left means that if the screen gets bigger, it will always try and stay in the bottom left

hand corner, which is what it's doing.

And so let's take a look.

Make sure that this script always stays switched on.

You can change these items if you want, but I'm not going to I'm quite happy with what I've got at

the moment.

This outer ring moment is a little bit too light for my liking.

So I'm going to click on this and I'm going to make it a black ring.

OK.

And it does need to be a rakas target so that we can interact with it.

Musker bullets.

Well, then we get a handle on the inside.

That's this little circle.

Now what I'm going to do them to click on Antil Plain and you'll see that you got a whole bunch of different

things.

I like this Andal ridged the drug, that one.

And he looks a little bit more effective now because it's Halloween style.

I want something that looks a bit more pumpkin like.

So I'm going to click on this and I'm going to make it like a really interesting sort of orange color.

Once again, Rakaa tailgate and musket ball.

All right.

Excellent.

That's it.

We're set up with our joystick.

So now it's time to actually write a script.

Going to go back to our sets and the right click, create a new folder.

I'm going to call it my scripts.

Double click inside, right click, choose create new Souchak script.

This one, I'll call it main.

Just mate.

All right, and it comes out as may not see us as a C sharp double click in order to open in.

Visual Studio, there we go, may take a while for that to open.

If this is the first time you're opening a Visual Studio, give it the rights to action to get online,

etc. And you will also have to log in using your unity ID, your version of Visual Studio might be like

a white background.

Well, I actually changed mine by going to where it was at.

We remember how to do this.

Uh, I'm looking for properties.

There we go.

But you wouldn't know.

Oh, nope.

Properties, OK, project and looking for some sort of settings.

Don't think his options, tools, options.

That's the one.

OK, and general color theme dark.

All right, guys, that's all I've chosen.

You do get a bunch of different ones if if you want to go with that.

OK, great.

So this is what your general script looks like.

They've already completed a bit of it for you.

These are a couple of popular methods from the start method runs when the game first, starts the first

frame and then never runs again.

The update is called Every Frame.

So if your game is running like 60 frames a second, the update will be called 60 times a second.

That's going to be important for us.

OK, so let's begin.

So, first of all, we need access to our joystick so we can time public off type joystick that we're

going to call joystick semicolon on the end to finish.

Now, what we've done there is we've simply made a slot that's going to be available in the inspector

by making it public means that it's going to be visible in the editor if it was private.

It won't be visible in the editor of type.

When it goes green, it basically means it recognizes as a type of a joystick.

And we've given it a specific name.

So if I were to save that now.

Wait for that to compile.

In other woods is converting it into machine language or whatever it needs.

I'm going to go to uh I'm going to go to ground, I think, and I'm just going to drag me directly onto

ground.

OK, that's it.

And that's what we've created.

We've created this little slot.

OK, now we can take our joystick, just drag it directly in there so that now it can talk directly

to that joystick.

And now I need access to the camera so I can move that so public.

Of type game object.

And you can just present it to autocomplete or return and I'll call this camp.

OK, once again, we've made another slot, so let's just say this.

And then let's take our main camera, drag that into come.

So that's now what we're going to be manipulating the movie.

OK, and then and what we need to know now is the rotation amount.

So this time, we don't need to define this in the inspectors film to make this private.

It's going to be of type float.

Float is basically a decimal number.

I'm going to call this.

Let me start off with a lowercase letter.

So, Robert, as in reputation, capital H, capital a what?

A H amounts.

OK.

So in other words, rotation, horizontal amount, an amusing camel case here, which basically means

you start off with a lowercase letter and every time you change the word, you use, not the case letter

whenever you use these names.

Never leaves spaces.

OK, it must all be one letter.

And the second great reason why it's telling me it's not being used.

Well, not yet, because I've not written anything yet.

But it's it's good that it actually tells you whether you're using something or not.

And do the same again, private float.

This time, it's going to be dropped the amount.

So then there was the vertical and horizontal.

OK, then I need to decide exactly how fast am I going to rotate.

So this is going to be public is available.

Inspectah, we can change it in the inspector of time.

Float again, decimal number.

Call this rotation speed.

Press equals and set this to about 35.

OK, so that's exactly how fast we are going to be moving.

Now, I'm not putting in the start.

I need to put in the update because I need this to basically update literally every frame.

And what I want to do is associate the rot H amount and the V amount with movement of the joystick.

Well, say, what's the amount to begin with?

Equals joystick.

Now, as soon as you press, don't we get access to all of the properties that belong to the joystick,

one of which will be vertical?

OK, so the vertical input is going to be passed through into this variable here and it's going to store

that number.

What's H amount equals?

And you've guessed it joystick.

The horizontal.

There we go.

So we've just passed those values through.

Now, what we need to do is move our camera so we can say, can dart transform, dart rotate.

OK, is capital R.

And then as soon as we open our brackets, it tells us exactly what its expected is expecting some Oyola

angles.

OK, so and what we're going to do is we're going to pass in the minus what the amount into the X.

OK, and I'm doing minus of it's reversed.

Otherwise, it's when you move, right, you're going to move left.

When you move left, you're going to move.

Right.

So I'm sort of reversing that and then I'm going to multiply that by the rotation speed.

OK, so that's the speed at which they're going to rotate.

Furthermore, I'm going to multiply that by time dot delta time and comma.

OK, so time dot delta time basically means each and every second.

All right.

It's going to do that per second.

If you don't put time that Delta time in there, what it does, it uses your frame time, seconds.

So it's running at 60 frames per second.

It will be doing running that command 60 times a second.

If your mobile's really not like two frames a second, you're doing that two times a second.

This ensures that it always runs at the exact same time on every device.

Always.

Exactly.

Once per second.

OK, then in the middle.

So if that if that's the X rotation value, this will be the Y rotation value now.

And I'm going to pretty much do the same.

So I'm going to say what's h amounts multiplied by rotation.

Speed multiplied by time, Delta time.

And then finally on the Z axis, I'm going to say zero.

Don't want it to move at all on the axis, just semicolon on the end.

So let's take a look at that.

So on that main camera.

We have to transform.

We've accessed we've got a rotation, we've accessed and we're saying move these values on the X and

the Y according to our we're and moving our joystick, whatever values we have coming from there, we're

going to pass through into this X and Y.

And that's going to then rotate our camera according to that.

Now, the moment it's not going to work correctly.

I'm going to show you why and then I'm going to give you a task, see if you can fix it.

And I will be showing you how to fix it, by the way.

But for now, that is going to get a camera working perfectly fine.

All right.

So and let me just click on ground, make sure that all my slots are all perfectly felt and make sure

that none of those are saying none, because if any of those are saying non, you're going to get a

read error.

And it's going to be a null reference exception error that you get.

OK.

So make sure that you're in simulator mode and we can press play.

Our mouse is going to act like our finger on the mobile device.

It's going to allow us to manipulate this.

So let's press play.

Here we go.

Now, when I move, I'm moving my camera.

But if I move up, it does move up.

If I try moving both at the same time, whoa, check out what happened.

I'm sort of getting this weird angle going on, which is which is not what you want.

All right.

You want it always to stay straight upright and not to be doing this weird angle.

So I want to give you a task, see by the next video, if you can figure out a solution to get that

fixed so that when you move left and right, it moves left and right perfectly.

And when you move up and down, it moves up and down perfectly.

The two did not work together to get this weird angle.

Angular motion is going on.

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