using UnityEngine; /// /// Smooth top/back camera that keeps the player and generated path visible. /// public class CameraFollow : MonoBehaviour { public Transform target; public Vector3 offset = new Vector3(0f, 8f, -8f); public float followSpeed = 6f; public float lookHeight = 1f; private void LateUpdate() { if (target == null) { return; } Vector3 desiredPosition = target.position + offset; transform.position = Vector3.Lerp(transform.position, desiredPosition, followSpeed * Time.deltaTime); transform.LookAt(target.position + Vector3.up * lookHeight); } }