Hi, first of all.
I have two GameObject :
If I do parenting object B to object A not at runtime, I obtain a fully correct compound object with a collider formed by the two capsules.
But if I try to do parenting at runtime (with the Hierarchy panel or by scripting) the result compound object has an incorrect physical behavior. Indeed, A and B are attached together but B object doesn't collide with the ground (Terrain) and hasn't infuence on the compound object physics.
Note : here the simple hierarchy
After somme debug tests, I found that if I do parenting B to A not at runtime, gameObjectB.collider.attachedRigidbody correspond to the rigidbody of the A object. It's ok.
But if I do parenting B to A at runtime, gameObjectB.collider.attachedRigidbody is null. This is abnormal.
Do you ever meet this type of problem and have you an idea to fix it ?
Thanks in advance for your help.
asked Apr 28 '10 at 02:18 PM
Add the rigidbody component after you do the parenting.
answered Apr 28 '10 at 03:51 PM