我如何更平滑地旋转摄像机轨道,而不仅仅是触摸旋转?也就是说,如果旋转后我关闭屏幕,相机仍然可以平稳旋转2秒钟吗?
public float _lerpRate = 0.64f;
private float _xRotation;
private float _yYRotation;
private void Rotate(float xMovement, float yMovement)
{
_xRotation += xMovement;
_yYRotation += yMovement;
}
void Update()
{
//if(!EventSystem.current.IsPointerOverGameObject())
if(EventSystem.current.IsPointerOverGameObject(Input.touches[0].fingerId))
{
}
else
{
_xRotation = Mathf.Lerp(_xRotation, 0, _lerpRate);
_yYRotation = Mathf.Lerp(_yYRotation, 0, _lerpRate);
transform.eulerAngles += new Vector3(0, _xRotation, -_yYRotation);
}
}