Invisible Wall in my cam collision system

Hello! I’m tying to make my camera don’t enter the walls but i don’t know what i have to do…

So, the camera collision is working but the walls disappear.

This is my code:

public class CameraBehaviour : MonoBehaviour
{
    public float camHeight;
    public float maxDistance, minDistance;

    [HideInInspector]
    public PlayerController player;
    public LayerMask obstacleLayer;

    Vector3 camTarget;

    private void LateUpdate()
    {    
        if (player.playerInputs.resetView)
        {
            camTarget = Vector3.Lerp(camTarget, player.transform.position + player.transform.forward * 5f, 2 * Time.deltaTime);
        }
        else
        {
            if (Vector3.Distance(player.transform.position, player.playerCombat.target.position) <= 3.7f)
            {
                camTarget = Vector3.Lerp(camTarget, (player.transform.position + player.playerCombat.target.position) / 2, 5 * Time.deltaTime);
            }
            else
            {
                camTarget = Vector3.Lerp(camTarget, player.transform.position, 5 * Time.deltaTime);
            }
        }
        
        Quaternion camY = Quaternion.Euler(0f, transform.rotation.eulerAngles.y, 0f);
        Vector3 forward = camY * Vector3.forward;

        CamCollisionPos(forward);

        transform.LookAt(camTarget);
    }

    Vector3 camCollPos;

    private Vector3 velocity;
    public float smoothTime = 0.2f;
    public float collisionOffset = 0.2f;

    Vector3 hitPoint;
    Vector3 point;
    void CamCollisionPos(Vector3 forward)
    {
        Vector3 smoothPos = Vector3.SmoothDamp(transform.position, player.transform.position - forward * minDistance + new Vector3(0f, camHeight, 0f), ref velocity, smoothTime);
        RaycastHit hit;
        if (Physics.Raycast(player.transform.position, -(player.transform.position - smoothPos), out hit, minDistance, obstacleLayer))
        {
            camCollPos = hit.point;
        }
        else
        {
            camCollPos = smoothPos;
        }
        transform.position = camCollPos;
    }
}

You should add install Cinemachine from the package manager and watch some tutorials on how to use it. There is a Cinemachine component that is called “Cinemachine collider” that won’t let it pass through walls.