Detaching child from parent when it collides with another object?

i have an F1 type car an i want to detach an object e.g part of the front wing from the body of the car when it hits an object like a cube or another car.
i have box colliders on all of the objects except the wheels because i have wheel colliders on them.
i know how to detach a child trough script but i dont know how to detach it when collided with an object.

do something like OnCollosionEnter() to detect collisions and once you collide do transform.Parent=null on the child to break it from the parent.