uniy:如何判断目标在自己的左侧还是右侧


   void Update()
    {
    
    
      
	     Vector3 Dir = target.transform.position - transform.position;
        if (Vector3.Cross(transform.forward, Dir).y > 0)
        {
    
    
            Debug.LogError("右面");
        }
        else
        {
    
    
            Debug.LogError("左面");
        }

    }

猜你喜欢

转载自blog.csdn.net/qq_36592993/article/details/88132148