实现朝着摄像机的方向进行移动物体
//状态处于移动时
if (showState==ShowState.moveMeter)
{
//定义方向
var dir = Camera.main.transform.position - waterMeter.transform.position;
waterMeter.transform.position += dir * Time.deltaTime * moveSpeedMeter;
//判断物体与摄像机的距离
if (Vector3.Distance(Camera.main.transform.position, waterMeter.transform.position)<=MeterToCameraDistance)
{
//物体旋转到指定角度
waterMeter.transform.DOLocalRotate(new Vector3(-45, -180, 0), 1f);
}
}