How do I setup camera collision?

cast a ray and put the camera on the hitposition and add some offset to make sure its a bitoff the wall/object.

check my resource: