Implemented raycastCameraKernel helper function.