I am trying to rotate an Object around the Y-Axis of another Object, 90 in one second (or another set amount of time) when I press a button. The rotation should be smooth though, not just "snap". Imagine playing a racing game where you just have to push one button in order to make a 90 turn around a sharp corner. (that's just a fictitious example, by the way). I tried
var target : Transform;
function Update ()
{
if(Input.GetMouseButtonDown(0))
{
transform.RotateAround(target.position, Vector3.up,90*Time.deltaTime);
}
}
but all it does is rotate the Object one frame every time I click the mousebutton. Is there an elegant way in Unity to do what I want? Or will I have to cook something up using a countdown variable or something? I know it's a simple question, but I need some help to get me started. Any help is much appreciated.