标签:poi ati targe set int oat unity relative bsp
三维向量夹角
Vector3 relative = transform.InverseTransformPoint(target.position);
float angle = Mathf.Atan2(relative.x, relative.z) * Mathf.Rad2Deg;
transform.Rotate(0, angle, 0);
二维向量夹角 (v1和v2为两个向量)
Vector3 cross = Vector3.Cross(v1, v2);
float angle = Vector2.Angle(v1, v2);
angle = cross.z > 0 ? -angle : angle; //unity左手定则,求出夹角
标签:poi ati targe set int oat unity relative bsp
原文地址:http://www.cnblogs.com/ZhiXing-Blogs/p/7682933.html