void Update()
{
Vector3 p1 = transform.position;
Vector3 p2 = target.position;
double angleOfLine = Mathf.Atan2((p2.z - p1.z), (p2.x - p1.x)) * 180 / Mathf.PI;//计算两点的正切值并获取角度
Debug.Log(angleOfLine);
}
void Update()
{
Vector3 p1 = transform.position;
Vector3 p2 = target.position;
double angleOfLine = Mathf.Atan2((p2.z - p1.z), (p2.x - p1.x)) * 180 / Mathf.PI;//计算两点的正切值并获取角度
Debug.Log(angleOfLine);
}
本文标题:判断两点的角度
本文链接:https://www.haomeiwen.com/subject/jlvcwrtx.html
网友评论