using UnityEngine;

public class CameraTracker : MonoBehaviour
{
    public Transform anchor; // CameraFollowAnchor
    public Vector3 offset = new Vector3(5f, 1.5f, 0f); // Side view offset
    public float smoothTime = 0.2f;

    private Vector3 velocity;

    void LateUpdate()
    {
        if (anchor == null) return;

        // Smooth camera movement
        Vector3 targetPos = anchor.position + offset;
        transform.position = Vector3.SmoothDamp(transform.position, targetPos, ref velocity, smoothTime);

        // Look straight toward +X or -X (whichever is side view)
        transform.rotation = Quaternion.Euler(0, 90f, 0); // ← adjust based on your orientation
    }
}