How to hit gameobjects to go into the opposite direction of hit?

I’m making a third person game and I’m trying to make a mechanic like baseball or tennis where when you hit the ball it goes in the direction of where you hit it. I made an empty child of the players hand and attached capsule collider to it. I have an animation where the player swings arm and I want to make so that if the ball collides with the empty object it goes in the other direction.

if you want it to go towards a specific position then get a vector3 which will be your target direction. get the position vector3 from where the object you want to hit currently is then do something like below

rigidbody.addforce( (targetdirection - currentposition).normalized * force);

or if you just want it to collide and launch it using physics just put colliders on your objects really.