How to use only the needed result of raycastAll?

Yes, that should be doable with that raycast.