Hi again guys,
I have a problem calculating a vector, that may be more a mathematical problem, and I cant figure out if I’m a jerk because I can’t find the correct function or because I always had F in maths.
Here’s the thing : I have two vectors, the green and the red. The green always points upward but the red can have differents direction and coordinates (and, as a consequence, can differ in length). I know the length of these two. What I want to do is create a Vector3f (the purple one on the picture) which has the same direction as the red one but the same length as the green one.
http://uppix.net/b/d/7/f681bc13e2a0a4c9ac161607a6fe3.jpg
How can I do this ? I tried to use the scaleAdd function of the Vector3f class like this :
Vector3f purpleVector = redVector.scaleAdd((greenVector.length()/redVector.length())/100, new Vector3f(0.0f, 0.0f, 0.0f));
But the result is a very tiny vector, that's strange...
Any ideas, guys ?