Stop Using Lerp Wrong! Here's a Better Way
Vložit
- čas přidán 21. 06. 2024
- A common mistake beginners make when using Unity's Lerp function for moving objects is keeping t, the blend factor, constant. While this does still work, it causes some problems that might affect you.
In this video I'll show you a much better way to implement lerp where you can also add your own custom smoothing using an AnimationCurve.
I felt like doing something new for the intro, hope you liked it lol
This is the dora theme remix I played: • Dora The Explorer (OFF... - Věda a technologie
Ah yes, always the correct way to learn. With Dora the explorer
the theme is 🔥🔥🔥
To anyone saying he’s strictly using it wrong, the original use case still has great utility for smooth exponential chasing, Freya holmer (queen of linear interpolation) has a whole talk about this and how to frame rate sync
Freya knows everything about programming related math
Didn’t know she had a talk on lerping but I would love to watch it!
i thought it was common sense to use lerp this way. what's the other way?
The other way is to keep t constant and set the starting position to the current position of the object being moved.
It causes the two problems mentioned in the video (non linear movement and the object not actually reaching the target position)
Some people are introduced to this method for smooth movement through tutorials and never learn otherwise. While it’s not exactly wrong, it’s much better to use the method I show in the video imo
I want to make a game since 2015, but i'm so noob i currently only do it with numerically (a set represent edge and another set represent the path) (and even this i had struggle to do it).
It would be game where we move along the sides of polygons leaving a trace of a certain color, we can go back this will trace [[above/beside] / this will make another floor ] and when we have gone around the polygon respecting the rules*, this changes the color of the trace and saves it if it does not already exist.
(*ex: no more than 2 round trips on the same segment/side)
Ah i see, i shall now use lerp using this method! 😮😅
To err is human; to use lerp correctly is divine
Someone had seen that Freya Holmer video too 😊
I actually haven’t haha but another commenter mentioned it too and I’ll probably watch it if I get the chance!
very informative and educational, someone like me who has never touched any form of code before can easily understand this. very nice! Very great! very awesome!!!
thats what im saying fr everyone listen to this guy
Great video! Very informative
I’m glad it could help!
beautiful video!
thank you! I spend a lot of time on visuals
this video seems more of an explaination to your misunderstanding of how lerp works because you closed the tutorial you were following as soon as the line of code at the beginning was written...you cant title a video stop using lerp wrong when youre the one using it wrong rather than the massively acceptable way
Sorry if I’m misunderstanding your comment but I had no tutorial open at the start lol the video on my laptop was something I made so I’m not completely sure what you’re talking about