void Update () {
transform.Translate (Vector3.right * speed * Time.deltaTime);
if (Input.GetKeyDown (KeyCode.W))
{
transform.localEulerAngles = new Vector3(0,0,90);
}
if (Input.GetKeyDown (KeyCode.D))
{
transform.localEulerAngles = new Vector3(0,0,0);
}
if (Input.GetKeyDown (KeyCode.S))
{
transform.localEulerAngles = new Vector3(0,0,-90);
}
if (Input.GetKeyDown (KeyCode.A))
{
transform.localEulerAngles = new Vector3(0,0,180);
}
}
with this simple arrangement i am able to rotate the object but how can i rotate it smoothly.
I can not find lerp function which accepts current rotation and future rotation and some float.
please help.