Unexpected raycast behavior - a bug or a feature?

The game I’m working on has a boat object with a lot of components; and I had been using a raycast from the mouse position to allow the player to click on a specific part of the boat. After I added a rigidbody to the (otherwise empty) main GO which serves as a “container” object for the entire boat, clicking on each part now registers as a click on the container Boat object rather than the specific part, apparently because raycasts check for rigidbodies as well as colliders (although it only returns the Boat object as the hit if the specific part itself has a collider for some reason). I’m not sure whether this is a bug or an undocumented feature - I guess it could be either depending on how you want to use raycasts. For me, it would allow me to let the player click anywhere on the boat to bring up a menu for interacting with the boat’s various parts, which might be preferable to clicking on the individual parts themselves; but if Unity changes this undocumented behavior at some point then my program might no longer work as designed.

This is a feature, like when in editor you click on a gameobject, it will first selext the parent, then tge child. To solve this problem, you need to take a look at the raycasts ignorelayer:
Put the parts of the ship to a new layer, get the layercount (I think GetLayerFromName or something) then ~(1 << layerId) will ignore every layer excpt for the shipd parts