Hello everyone, I want to detect the collision of a child object, for example I have a player object(parent) and contains the child objects which are the parts of the player(head,arms,legs…). I want to detect for example if my spear hits the head object which is child object and if does hit the head my player will die. I try to do the obvious technic:
if(collision.gameObject.tag == "Head")
{
Debug.Log("Enemy head");
FindObjectOfType<EnemyAI>().playerHealth -= 100;
}
else
{
FindObjectOfType<EnemyAI>().playerHealth -= 50;
}
But it doesn’t detect the tag.
BTW the script is attached to the spear object.