how to enable rigidbody by collision?

hello

The engine has a script named dragrigidbody. I have a hammer whit this script. next i have some wooden planks that act as a baricade. I want that the player can drag the hammer to the planks and slam them if the hammer touch the planks the planks fall.

gameObject.rigidbody.enable(true).

but it better if you just enable the gravity on hit.

void OnTriggerEnter (Collider other)
{
   if (other.tag == "plank")
   {
    gameObject.rigidbody.useGravity = true ;
   }
}