# How do child objects work with tags?

#1

So currently im trying to make a 2 player game where they joust it out with their rocket heads like rams and ive made a complete new rocket and i was wondering how can i make it so that only the rocket head kills the other player and not the entire body. Ive tried making the head in the prefab a death tag but it doesnt read it when i crash it into another rocket but when i marked the entire prefab rocket death tag it works but thats not what i want because they ships will die to any part of the rocket.

And then when i call the entire object death it works.

#2

Hi Jayy,

What is â€śthe other playerâ€ť? Arenâ€™t the players represented by â€śentire bodiesâ€ť?

The Rigidbody collects the messages sent by the colliders attached to the children and acts as a single collider.

• Unity manual: Rigidbody â†’ â€ścompound collidersâ€ť
• Unity manual: Colliders

#3

So the red rocket is called player1. and it has child object. One of the child objects being the head or (Jousthead) is what i tagged as death so that when the other rocket hits this head and just the head its the same as colliding with an obstacle and dies but it seems like the death tag on the jousthead is wrapped around the parents tag so nothing happens. How do i make it so that my childs tag gets called if thats possible? I would assume the only way is to unchild my jousthead but i dont know how to make it so an unchilded object sticks to another object.

#4

So far what ive done is given the joust head a rigidbody and that works but the problem is that it moves or if i freeze rotations and everything it still pushes into the rocket makiing it die if it collides head first with something. so basically what i want to do is working i just need the child object jousthead not to move at all when colliding with something. i already froze the positions but it still rotates when collided with something

so far ive worked around it by changing the cubes into spheres so the rotation wont matter but idk how good doing this will be in the future.

#5

You could try the following:

1. Duplicate the â€śheadâ€ť. Remove the MeshRenderer and the MeshFilter so you have a Collider only.

2. Create a new Layer (top right corner of your Inspector), name it â€śHeadâ€ť or whatever makes sense.

3. Go to Edit > Project Settings > Physics and have the Head layer interact with the Head only.

4. Add a new script to the head game objects and destroy the parent game object if a collision happens. Due to the layer, the other object will always be a â€śheadâ€ť.

5. Depending on the shape of your rocket, you could remove the collider from the visible head and make the collider of the â€śbodyâ€ť a bit higher so it covers the head, too. This is a little optimisation.

I donâ€™t know if this will work. In theory, it could.