Adding force to rigidbody if it collides with obstacle [image example] [Help]

Hi all,
I want to make an obstacle in my game that moves from left to right but i want to make it like if it collides with ‘ball’ then kick the ball in direction the object was moving i will attach picture to explain it better


Im using animation to move the obstacle [hammer] from left to right in swing motion and im wondering how can i made the ball get kicked if it collides with this obstacle i tried changing mass of hammer but it didnt do well both hammer and ball has rigidbody
i wrote something like this but i couldnt find on google anything how to add force as i want

var power : int = 500;

function OnCollisionEnter (hit : Collision)
{
if(hit.gameObject.tag == "Ball")
{
Debug.Log("BallHit");
hit.rigidbody.AddForce(transform.forward * power);
}

}

I’m not entirely sure but you might be able to make a Physic Material asset and set the bounciness to do what you want. It worked for me in a somewhat similar situation.

I’m not sure if this is entirely what you’re looking for or that I’m just confused on everything, but maybe making a collider separate to the Hammer that ‘isTrigger’ and you use that to knockback the ball the way you want? I hope this helps or I’m just being a weirdo xD