Hello
I have the following line:
Debug.Log((new Vector3(1, 0, 1) - new Vector3(0, 0, 0)).normalized);
From my understanding of the normalized method this should give me (1,0,1) but i get (0.7,0,0.7)?
Is this a bug or intended behaviour ? Documentation on it isn’t clear…
Intended behaviour.
A normalized vector is a vector with a length of 1.
(1, 0, 1) has a length of 1.4142135624
(0.7071067812, 0, 0.7071067812) (your result, without rounding) has a length of 1
Ah yeah i misunderstood. But then why is the angle between 1,0,1 and 0,0,0 90 degrees when it should be 45 degrees?
Vector3.Angle(new Vector3(0, 0, 0), new Vector3(1, 0, 1)); // 90 degrees?
If this is up 1 and right 1 thats diagonal and thus 45 degrees right?
Vector3.Angle takes 2 directions as parameters, (0, 0, 0) isn’t a direction. If you used (1, 0, 0) as the first parameter it would return the expected 45 degrees.
Oh so it doesn’t consider them like points on a graph? So i’ll have to use classic math methods to calculate the angle as if they were 2D points then ?
Calculating an angle requires 3 points. If you have 3 points, you have 2 non-zero length vectors you can plug into Vector3.Angle.
Yeh i’ll just stick to Atan2 probably easier 
Thanks for the help!
what are you calculating the angle for?
I want to get the 8 compass directions between vectors. Atan2 did the job of giving me the angle in degrees so it works now.
Alright then, best of luck with the rest of your project