//Calculate the angle between Vector a and b both originating from c private void AngeBetweenVectors(MyVector2 a, MyVector2 b, MyVector2 c) { Gizmos.DrawLine(pointCTrans.position, pointATrans.position); Gizmos.DrawLine(pointCTrans.position, pointBTrans.position); MyVector2 from = a - c; MyVector2 to = b - c; float angle = MathUtility.AngleFromToCCW(from, to); Debug.Log(angle * Mathf.Rad2Deg); }
//Calculate the angle between Vector a and b both originating from c private void AngleBetweenVectors3D(MyVector3 a, MyVector3 b, MyVector3 c) { Gizmos.DrawLine(pointCTrans.position, pointATrans.position); Gizmos.DrawLine(pointCTrans.position, pointBTrans.position); MyVector3 from = a - c; MyVector3 to = b - c; float angle = MathUtility.AngleFromToCCW(from, to, Vector3.forward.ToMyVector3()); Debug.Log(angle * Mathf.Rad2Deg); }