Unity Tutorials - Understanding TIME - FixedUpdate and DeltaTime

preview_player
Показать описание

Back to the Tutorial Series

Tubby Super Cat:

Physics in VR:

Odyssey Experience VR:

Mario Bros. in VR Demo:

MUSIC:
Kevin Macleod - Wallpaper
Рекомендации по теме
Комментарии
Автор

I HATE that all the tutorials simply say: "oh dont worry about this, you'll get it later" and then you simply never get it. Me as a developer should know what I am doing.

Thank you very much for this tutorial

SimplyParadoxic
Автор

At last!!


This is the first time I see a proper explanation on this topic, it's true what you're saying about forums tutorials and explanations, they always fly over this hard but essential topics.


It reminds me of when you did the 3rd person tutorial series, in which you took this same explanation style by teaching how to code your own character physics instead of taking the easy way of using pre-made rigidbody physics. Ease doesn't mean well done.


Here is an idea about a similar topic: the Lerp function for floats and vectors. I've seen in the video that you were lerping the camera position between the three slides, probably in Update through an index or something, but... ¿what does exactly mean that 3rd parameter?


I bet that your code looks like:


transform.position = Vector3.Lerp(transform.position, slide.position, Time.deltaTime);


But that 3rd parameter, t, is not expecting a time unit, it is just the interpolant. Of course it achieves the desired effect of an ease-out smooth movement, as it's interpolating position every frame by a super small interpolant amount (Time.deltaTime), but theoretically it should never reach its end, as t never will be 1.


Apparently it stops at the desired position, but if you look at the transform position values you can see how them are still approaching to slide.position for a while (well, they eventually stop because of floating number precision)


The proper solution would be a coroutine which use the normalised elapsed time as t, alongside an animation curve to achieve the ease-out smooth effect, or even use SmoothLerp to achieve an ease-in-out.


So, my point is, what do you think about and why do we use Lerp in Update even knowing that it's wrong?

Maximetinu
Автор

This is something I've been trying to wrap my head around for ages, this is actually really helpful!

segendo
Автор

The background music might be a little bit distracting... Other than that, great tutorial!! I especially like the way you do "slides" inside Unity.

andrecoccoconde
Автор

Great video, enjoyed the actual interactive graph where you pressed space and the objects move.

GameAudioLearning
Автор

Good job my man! You helped me not quit Unity and start understanding everything properly! Big like!

bardan
Автор

Nimsony Tutorials are the best there are! Could you maybe do some vr/physics tuts sometime? I’m really fascinated with your work in that area and would love to know more! Cheers!

CosmicComputer
Автор

thanks for a great short tutorial. Love your vids with VR stuff too

SlydogUTube
Автор

It's just I want, thank you soooo much!! It has confused me for a long time

bobsponge
Автор

Awesome breakdown of what's going on. Thank you!

emilyhorton
Автор

The helped me finish my class project! Thank you so much for making it!

ziggster
Автор

Problem, this video isn't in your Unity playlist.

Layarion
Автор

Thank you so much mate for the tutorials... 💗❤️⭐
Absolutely loved it .. 🎉🔥

abhisheksaraf
Автор

thx u are the best I never understood taht good

darkhacks
Автор

I honestly thought this was gonna be an April fools joke

zap
Автор

Pretty sure Time.fixedDeltaTime only ever returns the set number (default 0.02) so multiplying it to everything just to convert all your stored values to per frame times is inefficient. You're better off keeping all your values in per frame time if you keep them within the fixedUpdate(). Can just convert them for the rare times you want them read in per second times.
Thats why everyone but you just says you don't have to use it, your way is not only more complicated but also more inefficient.

Stringbats
Автор

So if you were going to shift into in-game slow motion, you'd use Update with deltaTime instead of FixedUpdate, even for physics? Or does interpolation handle that for you?

CoryPelizzari
Автор

Olá, estou criando um game de Bilhar e estou com dificuldades na física... Tem alguma dica? Devo diminuir o TimeStep? Desde já agradeço. Parabéns pelo vídeo. Abraço.

wilianlopes
Автор

Okey, but what if i don't need real world units? Fixed update gives me what i need. I assume if you are making more realistic game this matters more.

dawidfrankiewicz
Автор

might be a stupid question but how to put text on objects?

SgtRegg
join shbcf.ru