# How to rotate fluently/smoothly?

Hello!

At the moment I am making a game like Legend of Grimrock or the old type of games. I am wondering how I can do the fluent roating? At the moment I rotate like this:

`````` public void RightTurn()
{
this.transform.Rotate(Vector3.up, 90);
this.transform.forward = this.transform.forward.Round(0);
this.Turned();
}

private void Turned()
{
this.canWaitIntersection = false;
this.waitingIntersection = false;
this.OnPlayerTurned();
}

private void OnPlayerTurned()
{
Action<Vector3> handler = this.PlayerTurned;
if (handler != null)
handler(this.player.transform.forward);
}
``````

Any ideas and/or suggestions?

Here’s a script that rotates an object by 90 degrees if you press space. The rotation itself happens inside a CoRoutine. I’m still inexperienced in Unity and i suspect there’s an easier way to do it. But that’s how i’d do it today

``````using UnityEngine;
using System.Collections;

public class Rotator : MonoBehaviour
{
void Update ()
{
if( Input.GetKeyDown(KeyCode.Space) )
{
StartCoroutine( Rotate(Vector3.up, 90, 1.0f) );
}
}

IEnumerator Rotate( Vector3 axis, float angle, float duration = 1.0f)
{
Quaternion from = transform.rotation;
Quaternion to = transform.rotation;
to *= Quaternion.Euler( axis * angle );

float elapsed = 0.0f;
while( elapsed < duration )
{
transform.rotation = Quaternion.Slerp(from, to, elapsed / duration );
elapsed += Time.deltaTime;
yield return null;
}
transform.rotation = to;
}
}
``````