Comments and answers for "Vector3.Angle returning wrong values for vectors with small components"
http://answers.unity.com/questions/160514/vector3angle-returning-wrong-values-for-vectors-wi.html
The latest comments and answers for the question "Vector3.Angle returning wrong values for vectors with small components"Comment by juanitogan on juanitogan's comment
http://answers.unity.com/comments/1623384/view.html
Thu, 18 Apr 2019 06:25:56 GMTjuanitoganComment by Bunny83 on Bunny83's comment
http://answers.unity.com/comments/1623095/view.html
Wed, 17 Apr 2019 11:34:03 GMTBunny83Comment by VirtualSUN on VirtualSUN's comment
http://answers.unity.com/comments/1622940/view.html
Tue, 16 Apr 2019 23:57:59 GMTVirtualSUNComment by juanitogan on juanitogan's comment
http://answers.unity.com/comments/1622924/view.html
Tue, 16 Apr 2019 23:00:58 GMTjuanitoganComment by VirtualSUN on VirtualSUN's answer
http://answers.unity.com/comments/1573669/view.html
Wed, 21 Nov 2018 08:23:55 GMTVirtualSUNAnswer by elliselkins
http://answers.unity.com/answers/1174912/view.html
I ran into this problem as well, so I wrote my own angle functions.
//This returns the angle in radians
public static float AngleInRad(Vector3 vec1, Vector3 vec2)
{
return Mathf.Atan2(vec2.y - vec1.y, vec2.x - vec1.x);
}
//This returns the angle in degress
public static float AngleInDeg(Vector3 vec1, Vector3 vec2)
{
return AngleInRad(vec1, vec2) * 180 / Mathf.PI;
}
See [Atan2][1] for more details.
[1]: http://docs.unity3d.com/ScriptReference/Mathf.Atan2.htmlThu, 21 Apr 2016 20:23:50 GMTelliselkinsComment by $$anonymous$$ on $$anonymous$$'s answer
http://answers.unity.com/comments/598148/view.html
Mon, 16 Dec 2013 18:48:41 GMT$$anonymous$$Comment by chris.weigle on chris.weigle's answer
http://answers.unity.com/comments/598070/view.html
Mon, 16 Dec 2013 16:48:20 GMTchris.weigleComment by $$anonymous$$ on $$anonymous$$'s answer
http://answers.unity.com/comments/598066/view.html
Mon, 16 Dec 2013 16:42:41 GMT$$anonymous$$Answer by Adrian
http://answers.unity.com/answers/160517/view.html
Normalizing probably is the issue here. The documentation on [Vector3.Normalize][1] states:
> If the vector is too small to be normalized a zero vector will be returned.
`Vector3.Angle` probably normalizes the input vectors, calculating the angle between `(1, 0, 0)` and `(0, 0, 0)`. `Vector3.Angle` also seems to return `90` when either of its input vectors has zero length.
[1]: http://unity3d.com/support/documentation/ScriptReference/Vector3.Normalize.htmlFri, 26 Aug 2011 11:24:58 GMTAdrian