Vector cross product a ^ b
High school mathematics, we can get a formula a * b = | a | * | b | * sin <a, b>
You can be acquired using cross product of two vectors of the left and right positions, as shown in FIG.
One case (case y will be removed after a top view corresponding to the coordinate system x, z):
Vector3 a = new Vector3 (1,0,2);
Vector3 b = new Vector3 (2,0,1);
Vector3 c = new Vector3 (2,0,-1);
Vector3 d = new Vector3 (-2,0,-1);
// Use this for initialization
void Start () {
Debug.LogError(Vector3.Angle(a,b));//36.8699
Debug.LogError(Vector3.Cross(a,b).y);//3
Debug.LogError(Vector3.Cross(b,d).y);//0
Debug.LogError(Vector3.Cross(a,c).y);//5
Debug.LogError(Vector3.Cross(a,d).y);//-3
}
The above code we can see ∠aob = 36.8699 °
The dot product equation: a * Vector vector b = | a | * | b | * sin36.8699 ° = 5 * Root Root 5 * sin36.8699 ° = 3;