//旋转速度
public float RotateSpeed = 15;
private bool isTurn = true;
//private Vector3 newCameraRotate;
private Quaternion newCamRoatation;
private float RotateRemain;
void Update()
{
if(isTurn)
{
RotateRemain -= Time.deltaTime;
//从当前位置以一定速度旋转到目标位置
transform.rotation = Quaternion.Lerp(transform.rotation, newCamRotaion,Time.deltaTime*RotateSpeed);
if(iRotateRemain <= 0)
{
isTurn = false;
}
}
}
public void StartTurn(vector3 newRotate)
{
isTurn=true;
//newCameraRotate = newRotate;
//将向量transform的位置旋转到目标位置
newCamRotation = transform.rotation * Quatrenion.Euler(newRotate);
RotateRemain = 1;
}
使物体平滑旋转不完全笔记
最新推荐文章于 2022-09-24 16:09:19 发布