float speed = 0.5f;
float moveSpeed = 0.5f;
public GameObject obj_a;
public void judgePos(Transform trs)
{
//1.在自身的前后:
//返回值为正时,目标在自己的前方,反之在后方
float bumber1 = Vector3.Dot(transform.forward, obj_a.transform.position - transform.position);
float angle1 = Mathf.Acos(bumber1) * Mathf.Rad2Deg;
//2.在自身的左右:
//返回值为正时,目标在自己的右方,反之在左方
float bumber2 = Vector3.Dot(transform.right, obj_a.transform.position - transform.position);
float angle2 = Mathf.Acos(bumber2) * Mathf.Rad2Deg;
//3.在自身上下:
//返回值为正时,目标在自己的上方,反之在下方
float bumber3 = Vector3.Dot(transform.up, obj_a.transform.position - transform.position);
float angle3 = Mathf.Acos(bumber3) * Mathf.Rad2Deg;
//Debug.LogFormat("<color=red>bumber1:{0},</color><color=purple> bumber2:{1}</color>, <color=blue>bumber3:{2}</color>", bumber1, bumber2, bumber3);
Debug.LogFormat("<color=red>angle1:{0},</color><color=purple> angle2:{1}</color>, <color=blue>bangle3:{2}</color>", angle1, angle2, angle3);
}