How to conect rigidbodies, and then disconnect them when desired

Hi

When one needs to connect two (or more!) rigidbodies together, and then when needed, "let go" of objects on command, what are the necessary steps? (imagine a fighter aircraft dropping empty fuel tanks...)

It seems to me that there are various things that need to be considered:

-How to connect them to begin with?

-What physics properties must the objects share? (simply both being rigid bodies?)

-When/how to turn on the physics of the object to be released?

Thank you!

If you just want one object to follow another one, you don't even have to mess with the Rigidbodies (nor are they required), you can just set the parent of one to be the other. So in your example, you would set the parent of the fuel tank(s) to be the aircraft, and then when you want them to "drop", simply remove the parent-relationship, and the fuel tanks will no longer be "attached" to the plane, and thus, they'll fall.

See the Transform.parent reference for scripting examples on how to parent and de-parent objects. If you want to parent something in the Editor, simply drag an object onto another one in the Hierarchy.

If this isn't what you were looking for, post a comment (not a new answer), and I'll revise my post to help you as best I can.

The answer has, as suspected, a few parts.

First, rigidbodies will not normally stay together as the physics engine will act on them independently. To overcome this, on the child rigidbody, select "is Kinematic" in the inspector for the child.

When the appropriate time for release comes, set the isKinematic property to false:

     rigidbody.isKinematic = false; 

Next, to fall off naturally, one has to put the translational and rotational velocities into the child object so that it falls away naturally:

     rigidbody.velocity = transform.parent.rigidbody.velocity;
     angularVelocity = transform.parent.rigidbody.angularVelocity;

When all of that is complete, the child object can be severed from the parent with:

     transform.parent = null;

is kinematic looks good, but what if u want to attach a propeller to an airplane?