I got some optimization: now you check a cube (8 lines). why not make a "billboard" of your cube. I don't say this works in all situations, but you cast 4 lines instead of 8. Just turn the billboard towards the camera.