Wanna ask a question about the paramater 'ref CurrentVelocity' in the mathf.SmoothDamp function

Actually, I just simply don’t know what this paramater is about, you see in this function, I have ‘begin value’, ‘target value’, ‘time for move’, why does this function need a paramater like ‘ref CurrentVelocity’?
I searched the Unity Documents, yet still I don’t understand it, so… Could anyone help?

Thanks so much!

A “ref” parameter don’t pass the value of this variable to the function but a reference to this variable. That way the function can read the value and write it back to the variable.

SmoothDamp will move the “current” value (not begin) towards the target value with the current velocity. However to damp the movement when it comes closer to the target it has to reduce the velocity in order to slow it down. A function can only return one value which is the damped value. So velocity have to be passed as reference.