- Home /
Raycast hit on object's child only
I have an object, which has 2 child objects. Basically there is an image, has two circle on them. When the ray-cast method hits the image object, the child object also getting notified. I only want notification, when the ray hits the circles (the children on the image object). Separating the children from the parent is not an option, I have to find another solution.
Answer by DaveA · Oct 19, 2012 at 08:59 PM
What do you mean by 'getting notified' May need more information but some ideas:
Don't put collider on the parent.
Put children and parent in different layers. Use layermask to distinguish between them.
Use Tags and test the tag, ignore things you don't want.
By getting notified I mean: There is a piece of code in the spot object, that do something when a raycast hit it. But this code also runs, when I click on the image (the parent of spots), but not on the spots.
Your answer
![](https://koobas.hobune.stream/wayback/20220613082637im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Instantiate at Child Object 2 Answers
De-attach child from parent and remove from animation 1 Answer
Moving certain sprites in my animation causes weird slingshot effect 0 Answers
can i rotate a child object around the roots local axis using the childobjects reference point? 0 Answers
How do I reference the cameraEye in another script 0 Answers