Lerping Fundamentals - Learn How to Use It & When to Use Its Variants | Unity Tutorial
Вставка
- Опубліковано 31 лип 2024
- Lerping is one of the foundational things you need to know about in video game development! There are so many use cases for lerping it's impossible to name them all! Almost any time you want to rotate, move, or change a value over time, lerping is an option.
💸 Ongoing sales 💸
⚫ See all active asset sales on the Asset Store: assetstore.unity.com/?on_sale...
⚫ Save 25% off your first Asset Store Order: prf.hn/click/camref:1101l9QvC...
⚫ Save up to 50% on NEW Assets: assetstore.unity.com/?new_sal...
👨💻 As always, all code from this video is available on GitHub: github.com/llamacademy/lerpin...
❤ Believe in LlamAcademy's mission and have received value from the videos? Become a Patreon Supporter or UA-cam Member:
⚫ Patreon: / llamacademy
⚫ UA-cam Member: / @llamacademy or click the Join button on any video
📚 Resources 📚
⚫ Vector3 Lerp: docs.unity3d.com/ScriptRefere...
⚫ Quaternion Lerp: docs.unity3d.com/ScriptRefere...
⚫ Quaternion Slerp: docs.unity3d.com/ScriptRefere...
⚫ Color Lerp: docs.unity3d.com/ScriptRefere...
⚫ Mathf Lerp: docs.unity3d.com/ScriptRefere...
⚫ Wikipedia Slerp & Lerp: en.wikipedia.org/wiki/Slerp
----
Most tutorials come from knowledge gained making survival.llama.software Llama Survival - a top-down zombie survival shooter for Android and iOS.
I also have some Unity Assets (affiliate link): assetstore.unity.com/publishe...
Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.
#unitytutorial #tutorialtuesday #gamedev #tutorial #unity #llamacademy #gamedevelopment
Chapters:
00:00 Lerping Introduction - What is Lerp?
03:05 Vector3.Lerp - Fixed Time
04:15 Vector3.Lerp - Fixed Speed
05:37 Use Case for Fixed Speed Vector3.Lerp
06:07 Quaternion.Lerp and Quaternion.Slerp
07:34 Fixed Speed Rotation
08:45 Color.Lerp
09:39 Final Thoughts
Another common use for lerp is a smooth follow script, where the object moves towards its target and automatically slows down as it gets closer. This is done in an update timer constantly every frame, plugging its own position in for a, with a fixed t (which can be increased or decreased to adjust the speed).
Very true!
Brilliant tutorial. Thanks so much for this!
Nicely done sir! Really enjoyed this. Some great, clear examples!
exactly what I was looking for, thank you for the clear explanation!
This is really great. Well explained!
Thank you! 🙏
This is amazing, thank you
You're very welcome! 🤗
what an amazing guy
thank you
great tutorial, that really helps my dream become a reality :)
That's what I'm here for 😁
Thanks so much!
You're welcome 🙏
how can i use it for fixed speed vector3.lerp???
Thanks
Welcome! 🙌
Thanks , amazing tuto ,
Can you please make a tuto for :smooth swipe movement (left _right ) like runner games of casual games ?
Thank you again ❤
I'll add it to the list of topics to cover!
How would you go about making an object go from one point to another, but speed up as it gets closer to its destination?
I would do this with an AnimationCurve. In the future more advanced lerping tutorial I'm planning I'll cover that in more depth. But essentially you can define a
[SerializeField]
private AnimationCurve LerpCurve;
and instead of passing time directly into the lerp, you can use LerpCurve.Evaluate(time);
How do you lerp the cube between the two circle continuously for lerp with time?
you can have a MonoBehaviour that lerps from one to the other and track which one it should be going to
I know how to Lerp, but I need to know how do I Lerp from A to B, then from B to C? Where do I put this code and do I need a coroutine to do this?
If you want a 3 point lerp from A-> B -> C the easiest way to handle that is a coroutine (or update loop) just lerping exactly like you said, wait until you hit point b, then update to go to point C using B as the starting point for the second starting point and resetting your timer variable!
any idea how could i rotate an object with an overshoot? something like a elastic (springeffect)?
I have a video on springs here: ua-cam.com/video/6mR7NSsi91Y/v-deo.html
@@LlamAcademy nice. thank you
Do you have have toutoria about this shooting system 5:39
It's very important for my to understand how to make shooting system for my game.
Yup, here it is Bouncing Bullets with Hitscan Guns | Unity Tutorial
ua-cam.com/video/GkStW8-Q5P0/v-deo.html
@@LlamAcademy thenks
The file in GitHub is all pink as I import it in unity
🤔 are you using HDRP or URP? This repository was using Built-In Render Pipeline. That's just a guess
One thing I would have liked to see is lerping a scale
Scale works the same as position, since it is a Vector3. You can use the exact same code, but assigning to transform.localScale property instead of transform.position property
good tutorial but without complete scripts it's difficult for new learners like me.
Full project is on GitHub. Link in description
Lerp, Slurp and Leripng, all sound like rick and morty made-up words
lerp slerp....😁
me yes me
YESSS YOU💪
you can fricking lerp colors? 😅😅😅😅
Yeah! Pretty cool!