using System.Collections; using System.Collections.Generic; using UnityEngine; public class CameraFollow : MonoBehaviour { public Transform playerPos; public float smooth = 8; private Vector3 offsetPos; // Use this for initialization void Start() { offsetPos = transform.position - playerPos.position; } // Update is called once per frame void Update() { Vector3 camNewPos = playerPos.position + offsetPos; transform.position = Vector3.Lerp(transform.position, camNewPos, Time.deltaTime * smooth); } }