Afrikaans
Akan
Albanian
Amharic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
In this video we're going to take a look at why we're moving so quickly to the right.
When we type transform not translate vector 3D outright in order to understand this we have to understand
how update is working.
Update is called once per frame typically about 60 frames per second vector 3D out right is the equivalent
of typing new vector 3.
Unit on the x 0 in 0 on the wife Z.
When we say one unit in unity that's the equivalent of one meter in the real world.
So what's happening here is we're moving our player to the right one meter per frame 60 meters per second
what we actually want to do is move our player to the right one meter per second.
So we need to do is we need to convert one meter per frame to one meter per second in the way we do
that is by incorporating real time and to do that we multiply the vector by time delta time time no
doubt the time is going to do the conversion process from frame rate dependent to real minutes seconds
and hours for us time not total time can be thought of as one second.
So if we actually were to run this and we actually were to play this you'll see here that we are now
moving one meter per second to the right and we can actually witness our character moving the technical
term for time not that the time is really the time and seconds it took to complete the last frame to
the current frame and in reality what's really happening here is it allows us to use real time.
So if I needed to create for example a five second timer I could just add timed I don't the time to
a variable and check it for five seconds.
This is the equivalent of incorporating real time into use it you simply just multiply it by a vector.
Now what I want to get into next is how can we move five meters per second.
Well right now we're moving one meter per second.
All I have to do to move five meters per second would be to multiply our vector three not right by five
and then multiply that by timed out delta time.
This is going to convert to five meters per second if we hop into unity once our code is compiled I
can run the application and you'll see here that we are now moving five meters per second.
Now how does that work and why does that work.
Well this comes down to something in mathematics called the distributive property and what it does is
you can see here that we have vector three right multiplied by five multiplied by real time.
And what's happening here is basically what's on the side of the parentheses is getting multiplied by
what's inside the parentheses.
So here we have 1 times 5 which becomes 5 and then we multiply that by real time.
So we're moving five units to the right.
Anything multiplied by zero stays zero.
What happens if I change this to vector three dot left.
Well if I change that to vector three about left that's the equivalent of typing new vector three negative
one and then still I have a five here so negative 1 times 5 is going to be negative 5 0 times 5 is going
to be 0 in 0 times 5 on the Z is going to be zero.
So now we're moving negative 5 units to the left per second because we're using real time.
So I hope that makes sense to you go ahead and test it out and you should be able to move me just for
a second in the next video we'll take a look at creating our first variable.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.