unity c# rotate object over time code example
Example 1: unity rotate object over time
transform.Rotate( Vector3.up * ( rotationSpeed * Time.deltaTime));
Example 2: 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); }