Finding different parts of body by ray (455347)

Hi Guys.
I’m working on a First Person Shooting game and I want to use a ray for shooting system.
The question is how i can distinguish the different parts of enemy’s body that bullet hit to it.
I know that we can use some physical shape on each part of body then use a ray to find it but it is
obvious that, this method cant be exact in lots of situations.

I have some other ideas but none of them is pure and satisfying.
I want to ask community if anyone can help me?

When you raycast, it returns the gameobject it hits as well as coordinates. You should then be able to map those coordinates to a specific bodypart.

can you explain more?
For character we have a character controller that use a capsule collider so if i use a ray for casting to characters, the ray hit to capsule.
if i ignore that so i should use a mesh collider (i think for finding that coordinate) and another problem is that the characters have animations and i think
mesh colliders generate from default mesh not current pos according to animations.

For static geometry and non-skinned meshs, you could use MeshCollider with “IsTrigger = true”. But for skinned meshs, you can’t really use MeshColliders. So for example you could create box colliders or whatever around the bones of your character so that they can be moved independently according to bone animations in realtime. Since I am currently not at this stage in my project i have not yet investigated how this could be implemented in detail… I am pretty sure that this is already solved in some sort of community asset or script, since you need it so often…

Thanks MrBurns.
This method that you mentioned is one of the ways to solve this problem in my mind too.
And I test it a little (only for head) before but the problem is that you cant cover the complex body (human or monster) by some
box or sphere with high accuracy.
what do you think for having 100% accurate in shooting?

I use another way to find the skinned mesh by making a vector and intersect it with the skinned mesh triangles through its vertex.
then find an intersected triangle and find sub meshes and materials so through materials i could find the exact
part of body that bullet was shot.
But if you thinking of this solution you can find how complex proccessing should proccess so it’s not logical to use this method.