ベクトルの外積のA ^ B
高校数学、我々は、式* B =取得することができます| | * | B | *罪<A、B>を
図で示すように、左右の位置の2つのベクトルの外積を用いて取得することができます。
一つのケース(ケースyがシステムの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
}
上記のコード我々は∠AOB= 36.8699°見ることができます
内積の式:| | * | b *のベクトルベクトルbを= | * sin36.8699°= 5 *ルートルート5 * sin36.8699°= 3;