- Home /
How to determine which part of an NPC is hit?
I have an NPC model that looks like a human. I use a capsule collider to coarsly determine whether the NPC has been hit e.g. by an arrow. When I detect a collision of the arrow (or its raycast) with the capsule collider I would like to know the part of the NPC's body that was hit (e.g. arm, leg, torso, head)
How can I best achieve this?
I thought about using capsule colliders around the bones and then apply a raycastall to check which parts of the body have been hit. Is this appropriate?
Answer by qJake · Sep 07, 2010 at 12:28 AM
The best (and possibly only) way to achieve what you want is to have one collider for each "part" of the body you want to check, i.e. one for the torso, arms, head, hands, legs, etc. Short of doing some incredibly complicated math with the "hit point" of the collider, that's the best/easiest way.