Limit CGVector's length while keeping its direction

Viewed 174

I need to move between two SpriteKit nodes with a CGVector, whose length is, for example, 100 (red arrow).

But I want to limit the vector's length to 70, if it's more than 70 (green arrow). So, I need to "cut" the red vector's length, but keep its direction.

Drawing of a vector showing actual length and limited length

How can I do that?

1 Answers
Related