So, I’m very new to Unity and C#. I’ve written this script and I’m having some issues with it. Here it is:
using UnityEngine;
using System.Collections;
public class DoorMovements : MonoBehaviour
{
public Transform start;
public Transform end;
public float speed;
void DoorOpen ()
{
transform.rotation = Quaternion.Lerp (start.rotation, end.rotation, Time.time * speed);
}
void Update ()
{
if (Input.GetButtonDown ("Fire1"))
{
DoorOpen ();
}
}
}
It works, except instead of the object I want to move (a door) moving slowly, it moves instantly. Any ideas on what I’m doing wrong?
Thanks