Modulating values with Lerp - Unity Official Tutorials

Unity · 186K views · 2013 · 5:32

Open on YouTube

Game programming & enginesIndie game developmenttutorial

Why Stack Overflow recommends it

Stack Overflow users link it when answering Unity questions about moving, rotating or blending objects smoothly over time, as an authoritative intro to Lerp.

Recommended by 4 people across 4 different months, 2015 to 2017.

What it is

A short official Unity beginner scripting tutorial explaining how to use Lerp (linear interpolation) to smoothly transition between values such as numbers, vectors and colours. It is part of Unity's learning series and shows the technique in code.

What people said

Recommends ʇolɐǝz ǝɥʇ qoq · 2015-02 · Stack Overflow · on “Best Settings for perfect smooth unity motion”

Try to use lerp. It is a function made to smoothly transition things. Watch the video [this video] or read the documentary [LINK] . I hope this helped!

Recommends malle · 2015-04 · Stack Overflow · on “rotate cube smoothly in unity”

If you want to rotate it smoothly I would recommend the Lerp function, there is a really good tutorial about it made by unity themselves: [this video] I hope that helps

Recommends Ori Frish · 2015-10 · Stack Overflow · on “unity 2D how to move object between two positions”

You are messing some things up, Vector.lerp is used in Update, since it's a function that should work for every frame until it's done. It works from 'Source' to 'Destination', so as you click again, it will still run from the source to the destination, if you want to change it, you need to design your code in a way it will swap places. like setting a flag or creating another function. This is a good tutorial from the Unity developers on how to use Lerp. Vector3 Lerp Video [this video] Vector3 Lerp Scripting Reference [LINK]

Recommends amdev · 2017-09 · Stack Overflow · on “Slowly moving gameobject to mouse position”

i guess you are doing wrong , because wile you have Mathf.Lerp [LINK] you Dont need to go as that clumsy way Here is a video tutorial from youtube for mathf.lerp [this video] and here is the base code: someValue = Mathf.Lerp(initialValue , finalValue , Time.deltaTime * smoothness); just take a look to the youtube link you will definitely get the idea! AS A SIDE NOTE you dont need to do alot of stuff to decrease your game performance! be careful about this kinda coding!