public GameObject lookPoint;
public Vector3 direction;
void Start()
{
}
// Update is called once per frame
void Update()
{
direction = lookPoint.transform.position - transform.position;
if(Vector3.Angle(direction, transform.right) > 90f) // 目标点在右边
{
transform.Rotate(transform.forward, Vector3.Angle(direction, transform.up));
}
else // 目标点在左边
{
transform.Rotate(transform.forward, -Vector3.Angle(direction, transform.up));
}
}