Let’s say I have two items: a unit direction vector, and another arbitrary vector.
What I want to get is the length to make the unit vector so that it covers the “distance” or magnitude of the other vector. So the new vector “contains” the other vector but maintains its direction.
Do you see what I’m saying?
If I understand you correctly (you want vector v):
You want a vector v = (An) where:
Here A is just a number, n is the unit vector and b is the arbitrary vector.
What this means is you want a vector with length A, but if you were to rotate the world so that b was on the x axis, the x component of (An) would be |b| (absolute value of b)
Therefore, in components:
where n1 means the 1st (x) component of the vector n.
Therefore just re-arrange:
So the vector that you’re are looking for is:
v = A*n = n * |b|/(n.b)
I believe that’s what you want.
Edit: I broke that into components when I REALLY didn’t need to. Components are useful if you don’t understand what all the terms mean though. But here’s it in just vector maths: