Interacting with parts on a single object/mesh

I’m developing a car interaction app for mobile platform. The car is rigged/animated and is part of a single mesh.

Using touch input you can, open/close the doors/ bonnet, turn on the lights etc.

If I casted a ray from the touch position to the object, how do I know which part of the car to interact with? (Since the whole thing is one mesh)

Unity - Scripting API: RaycastHit.textureCoord gives you the uv coordinate of the hit. so for example have a simplified/coarse texture of your car with interactive regions color coded and get the pixel at the uv coordinate.
fe door can be red, wheel is green etc…

Ok that should actually work well. But how do I do it in the final textured model where all doors have the same color.

Its kinda confusing…

i dont mean that you should pick the color from the actual texture of your car. when you have drawn the texture make a copy of it. reduce the resolution and draw any of your interactive elements in a certain color. this texture is not applied to your mesh, its just for lookup purpose and thus the shape of the car looks same but the objects of interest are drawn in a certain color so you can determine from the position on the texture which part (if any) was hit by the touch.

Ok my friend game me an idea:

  1. Create mesh colliders for all the interactive parts of the car.
  2. Import the animated/rigged model into the scene.
  3. Import the colliders and attach them to empty GameObjects (I still haven’t figured how to import custom colliders yet)
  4. Select the bone heirarchy and attach the corresponding collider its bone.
  5. OnMouseEnter should work for all the interactive parts.