Angle between two vectors (422457)

Hello,

How can I get the angle between two 3D vectors and the sign of this angle ? The Vector3.Angle return the angle but no the sign.

Someone posted a reusable code, but I can’t manage to find it again.

Anyway, have a look at this : http://forum.unity3d.com/viewtopic.php?t=14659&highlight=cross+angle

I think you’ll probably find the answer in the thread AkilaeTribe linked to, but just to elaborate a bit, the sign of the angle between two vectors in 3-d can only be determined with respect to a given reference frame. (That is, if you just imagine two arbitrary vectors in 3-d, what is the sign of the angle between them? How would you determine the sign without having any additional information available?)

All you need to establish a reference is one vector. Once you have this vector, take the dot product of it and the cross product of the two input vectors; the sign of the result is the sign of the angle.

What the reference vector should be depends on the circumstances, but if this is for measuring an angle with respect to some sort of humanoid character (as is common), the character’s ‘up’ vector is a logical choice.