using UnityEngine;

public class SideCameraFollow : MonoBehaviour
{
    public Transform target; // player (runner)
    public Vector3 offset = new Vector3(-5f, 2f, 0f); // side view offset
    public float followSmoothTime = 0.2f;

    public Vector3 rotationOffset = new Vector3(0f, 90f, 0f); // new!

    private Vector3 velocity;

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

        // Follow player's Z and Y, offset on X
        Vector3 desiredPos = target.position + offset;
        transform.position = Vector3.SmoothDamp(transform.position, desiredPos, ref velocity, followSmoothTime);

        // Apply custom rotation offset
        transform.rotation = Quaternion.Euler(rotationOffset);
    }
}