Ragdoll Collision
I am trying to detect when a ragdoll collides with certain objects but I don't want to have to add the script to every body part of every ragdoll (as that would be very tedious). Ideally I would have one script only on the parent object of the ragdoll.
This is the code I want to run for every child object of the parent:
void OnCollisionEnter(Collision other) { Debug.Log ("Collision with object"); }
Answer by SarperS · Aug 07, 2016 at 07:03 PM
You don't have to. Just add it to the top-most parent with a rigidbody (root). Collision messages are sent through the object hierarchy.
I tried that too. I added the script to parent object and it only detects collision on it, not any children.
Other people have said this too: http://answers.unity3d.com/questions/633480/how-to-detect-child-object-collisions-on-parent.html
Your answer