Hello!
I have a pretty basic camera script, but when my player speeds up I want my camera to zoom out to compensate, and vice versa.
If anyone knows how to do this please help, and if possible try to explain the logic behind it. Thanks!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraController : MonoBehaviour {
public GameObject player;
private Vector3 offset;
// Use this for initialization
void Start () {
offset = transform.position - player.transform.position;
}
// Update is called once per frame
void LateUpdate () {
transform.position = player.transform.position + offset;
}
}