I was wondering if there is a formula to clamp distance between two Vectors. Let me elaborate.
I have two Vectors, say, $V_1(x_1,y_1)$ and $V_2(x_2,y_2)$. I can find the distance '$d$' between them using $\sqrt{(x_2-x_1)^2 + (y_2-y_1)^2}$.
Now, I want to clamp $d$ to, say $5$, if $d>5$, and I know $v_1$, which is the initial position. I also know the current value of $v_2$. However, I want to calculate $v_3$, which lies in between the two points which form a straight line, for which $d=5$ from $v_1$. And is collinear to the line formed from $v_1$ and $v_2$.
Any help is appreciated.