unity rotate an object over time code example
Example: rotation over time unity
public float smooth = 1f; private Quaternion targetRotation; void Start(){ targetRotation = transform.rotation; } void Update () { if (Input.GetKeyDown (KeyCode.Space)) { targetRotation *= Quaternion.AngleAxis(60, Vector3.up); } transform.rotation= Quaternion.Lerp (transform.rotation, targetRotation , 10 * smooth * Time.deltaTime); }