using UnityEngine;

public class FollowMouseCamera2 : MonoBehaviour
{
    public Camera cam2;   // assign Camera 2 di Inspector
    public float distance = 10f;

    void Update()
    {
        Vector3 mousePos = Input.mousePosition;
        mousePos.z = distance;

        Vector3 worldPos = cam2.ScreenToWorldPoint(mousePos);

        transform.position = worldPos;
    }
}