Smoothing movement between any two particular values:
You have currentQuantity and desiredQuantity.
- only set desiredQuantity
- the code always moves currentQuantity towards desiredQuantity
- read currentQuantity for the smoothed value
Works for floats, Vectors, Colors, Quaternions, anything continuous or lerp-able.
The code: SmoothMovement.cs · GitHub
If you just want a Basic First Person controller, here’s one:
That one has run, walk, jump, slide, crouch… it’s crazy-nutty!!
(It relies on the natural smoothing in the Input.GetAxis() rules however)