Raycast should hit invisible stuff

We use raycast to quickly (as fast as possible) define which entity is between two points being hit by a line. The ray in the name have rarely anything to do with the light in our games. Therefore there is very little benefit from not hitting invisible items with it. Another reason is that triggers and raycasts behave weirdly different - there is no problem with trigger hitting invisible stuff.

Why it could be needed to hit invisible stuff? Answer is kitbashed mobs - if we make an NPC-like entity, which we want to allow player to hit, it is much easier to bind hit to a single entity, such as a f.e. voxel mesh, which repeats (within reason) form of the rest of kitbash. If mob consists of say 20 entities kitbashed together - adding script to all of them is very tiring. Writing the code which goes over tree and finds topmost entity with some script - is viable solution, but not very convenient and also takes some performance from solution, especially if we hit some part of terrain, depending on how deep the tree is - misses might take some CPU too, while alternative won’t need to go over tree.

This might in some situations break some games, which rely on raycasts missing invisible stuff, so maybe could be opt-in?