Does raycasting suited on this?

How? I need the ray to be perpendicular to the camera. Meaning it should only cast a straight line directly to the camera so that I know if it is behind or now.

Any idea how to it efficiently?