Hello!
How to make , when you press the J key, smoothly changed range
if (Input.GetKeyDown(KeyCode.J))
{
lightT.range = Mathf.Lerp(startRange, endRange, speedRange);
}
in my case, everything happens instantly, you can example?
Thanks
Hello!
How to make , when you press the J key, smoothly changed range
if (Input.GetKeyDown(KeyCode.J))
{
lightT.range = Mathf.Lerp(startRange, endRange, speedRange);
}
in my case, everything happens instantly, you can example?
Thanks
Here’s all the documentation you need to do it.
I wouldn’t touch coroutines for this because it’s just unnecessary complexity, especially if you plan to possibly interrupt or reverse the transition.
Instead:
Fading, simple and easy:
Smoothing movement between any two particular values:
You have currentQuantity and desiredQuantity.
Works for floats, Vectors, Colors, Quaternions, anything continuous or lerp-able.
The code: SmoothMovement.cs · GitHub