Finally functional ray hit detection