using UnityEngine;
public class Rotate : MonoBehaviour
{
float _currentSpeed;
float _targetSpeed;
[SerializeField] float _speedRotate;
const float c_acceleration = 20f;
const float c_di_acceleration = 10f;
float _acceleration;
private void Update()
{
_targetSpeed = Input.GetAxis("Mouse Y")*_speedRotate;
_acceleration = _targetSpeed != 0 ? c_acceleration : c_di_acceleration;
_currentSpeed = Mathf.MoveTowards(_currentSpeed, _targetSpeed, _acceleration * Time.deltaTime);
}
}