[SerializeField]
public float speed;//旋转速度
public Vector3 center;//旋转点
private Vector3 origin;//记录初始位置
void Start()
{
center = Vector3.zero;
origin = transform.position;
}
// Update is called once per frame
void Update()
{
//绕着旋转点
transform.RotateAround(center, Vector3.up, speed * Time.deltaTime);
//偏差
Vector3 offset = transform.position-origin;
//看向偏差点
transform.LookAt(transform.position + offset, Vector3.up);
//更新记录原来的位置
origin = transform.position;
}