camera.position = Vector3.Lerp(camera.position, goalPos,velocity*Time.deltaTime);
This approach… It’s being repeated over and over, given as an answer on formus… it’s completely wrong and bad. Why?
Lerp simply returns a linear interpolation between the two values, the first two arguments. The third argument is just a factor, amount of blend between those two.
The line above takes deltaTime as the factor. No matter how many times you execute that, no matter how many updates pass, the camera.position will never reach goalPos, because there’s always some fraction of the goalPos left (Unless deltaTime is more than 1). Moreover, it’s very framerate dependent. On different FPS, the rate of approach will be different (see again the example with deltaTime = 1, when the goal would be reached in one frame and otherwise never). If you have unstable FPS, the motion will also be stuttering.
To smoothly move a value to its goal over time, you can use MoveTowards (with constant speed), or SmoothDamp (which accelerates and deccelerates smoothly towards target). Please don’t ever ever use deltaTime as factor in Lerp, discard any tutorials that tell you to do so, it’s a very common misconception.
Regarding your actual question, I am not aware of an interpolated speed property, but you can easily calculate it. The speed is given in units per second. If you need to access it in Update(), you could simply remember previous interpolated position from previous Update, make a difference and divide by deltaTime (which is a deltaTime from previous frame, so there still might be some stuttering if you use that for motion). Also it would give you the position delta from the last frame, and not speed, which has meaning over time. Velocity of a rigidBody really only changes on FixedUpdate() (or rather, the Physics step) and is constant in between.
For the camera smoothing, just do
cameraPosition = Vector3.SmoothDamp(cameraPosition, targetPosition, ref m_velocity, smoothTime, Time.deltaTime); where smoothTime is an approximate time you expect the camera to reach a new position from any distant stationary position, and m_velocity is a variable where you remember the smoothing motion velocity (just declare a field and let the SmoothDamp use it).