How can I make a third person camera collision script?

How can I make a third person camera collision script? I have the actual Third Person Camera part working but I need to stop the camera from traveling through certain tagged objects. At the moment I have been using raycasting but it is unreliable when you swing the camera to fast into an object. Once the camera is inside the object, the raycasting no longer works. I have tried the OnCollisionEnter syntax but it doesn’t work. Plus the objects do not have rigidbodies on them. Please help.

P.S. I do not want to have to redo my third person script and I do not mind of the camera collision syntax is in a totally different script file. It must work with Mesh Colliders

Is it necessary in a script?
You could put a collider on your Camera, and then assign it to the right layer then in the physic settings make it collide only with the objects you want?
Hope i’m helping …

Why not use Cinemachine? They’ve figured this all out. Target following, target group follwogin, look at, confinement, collisions, you name it.