Add force to child

How do I add force to a group of child objects on a key press and then detach them so they can float freely in the direction they were launched?

The idea is to make something like breakable glass, where each piece of the object is actually held together by an empty and on a push of a button, the pieces have force applied and separate, giving the illusion of breaking apart.

You could start with each child object's rigidbody set to is-kinematic. When the parent object moves the children will follow.

Next: just before (or after?) applying the force turn off is-kinematic on all the children. You can un-parent them with one function call: Transform.DetachChildren. (Note: unparenting them is probably optional. According to the "Parenting" section of the Rigidbody docs, non-kinematic children will still react to forces on them. As long as the parent stays still it should work.)

There are various ways to apply the force. The first one to try is probably Rigidbody.ApplyExplosionForce because the same call for each child (same force and position args) will produce a varying effect depending on how far each piece is away from the center of the blast. But if that doesn't produce the desired effect, you could calculate the position and force differently for each child object. (For example, if the blast doesn't emanate outward from a single point, you might want to push the child objects mostly in the same direction, or collapse them inwards.)

Edit: I haven't tested this, but the code to detach the children after applying an explosive force to them centered at the parent's coordinates might look something like this, in a script attached to the parent:

for (var child : Transform in transform) {
  child.rigidbody.AddExplosionForce(5.0, transform.position, 10.0, 2.0);
transform.DetachChildren(); // this line may be optional, as long as parent object is stationary