GameObjects, Imported Models, and Parent/Child Relationships

This is related to this question:

Using the method in the answer, what is the proper way to handle collision? Does the Parent (which has the script) use the child for collision purposes?

Example scenario:

Object A is the GameObject and Child model. The parent's script is responsible for movement. The child has no script.

Object B is another object.

B has isTrigger set, so when it collides with A, it will call a function in Object A's script. However, it doesn't appear collision is actually taking place.

Side question: Will the child use the parents rigidbody, or do they both need that component? The parent needs it for movement.


No and yes. A parent can use a child for collisions, but really that depends on your interpretation as to what that means. Only the GameObject with the collider that was collided with will send/receive collision and the example scenario you describe will not function as you seem to expect it to because the object with the collision events in the script is not the one to which the Collider is attached. To "use a child for collision" you would likely do something like:

  • Use the mesh of the child GameObject in the parent's MeshCollider's Mesh. This will not scale and rotate with the child.
  • Add your collision script to the child. If you need to change something in the parent's script on collision, then you can get a reference and make those changes or call a function to make those changes in that script, or in stead of getting a reference, you could use SendMessage if you like.