How to use only the needed result of raycastAll?

Isn’t that what you want though? A raycast function that ignores certain groups/layers of rigidbodies? The code above adds a new function to the rigidbody system. So instead of calling raycastFirst, you would call raycastFiltered.