Smooth rotating object to click.

Hi, I have a script that rotates an object to click, but it does not smooth, I mean.
The object rotates immediately but I want me to do the journey to click.
My script is this:

var mouse_pos : Vector3;
var target : Transform; //Assign to the object you want to rotate
var object_pos : Vector3;
var angle : float;

function Update () {
if (Input.GetButton (“Fire1”)){
mouse_pos = Input.mousePosition; mouse_pos.z = 5.23;
object_pos = Camera.main.WorldToScreenPoint(target.position);
mouse_pos.x = mouse_pos.x - object_pos.x;
mouse_pos.y = mouse_pos.y - object_pos.y;
angle = Mathf.Atan2(mouse_pos.y, mouse_pos.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(Vector3(0, 0, angle));
}
}
Note: The object must turn on its own axis.

Did anyone know how to modify my script to do the journey? And not immediately? some delta time or lerp … excuse my English.

I have long been looking for a solution, but I find nothing… :frowning:

Take a look here, this may help: Unity - Scripting API: Quaternion.Lerp

Thanks for answering. I was already there. not modify this script with the Click of the mouse. :frowning:

Already solved.