I already have a camera script which makes the camera follow the player (the player is a spaceship by the way) and it works pretty good. However, for my game, I would like the camera to follow the player like it does right now, but I would also like the camera to start following the player after a short period of time.
Here’s what I mean: Let’s say that we have a public float variable named delay. Once the player starts moving, the camera should wait for a specific amount of time which is defined by delay and then start following the player the way it already does.
Here’s the whole camera script I already have:
using UnityEngine;
using System.Collections;
public class CameraController : MonoBehaviour {
public GameObject player;
private Vector3 offset;
void Start () {
offset = transform.position;
}
void LateUpdate () {
if (player != null) {
transform.position = player.transform.position + offset;
}
}
}
So how am I supposed to do that?