I’ve attatched this code to a 2D sprite of which I want to rotate 90 degrees under 3 seconds but I don’t really seem to make it work properly.How do I use Time.deltaTime in this case or am I suppose to use anything else to make it work?
var klick : int;
function Start () {
}
function OnTriggerStay2D(other : Collider2D)
{
var rotationTime : float = Time.deltaTime * 3;
if (klick == 1)
{
GameObject.Find("Door_1").transform.Rotate(Vector3.forward * 90 * rotationTime);
}
if (Input.GetButtonDown("Fire1"))
{
klick = 1;
}
else
{
klick = 0;
}
}