Can't find a good way to bounce off of enemies

I can’t figure out how to make it so when the player touches the enemy, will bounce them away the way that they came. I’ve tried velocity on the rigidbody2D: I get weird results that glitch the player away.
I have it in a OnCollisionEnter2D for now where it detects the tag of the enemy.
I’ve searched for a couple of days now and I can’t find anything that’s like what I’m looking for.

Are you trying to bouce the player away from the enemy or enemy away from the player (or both away from each other)?

Either way, the solution is similar. Subtract the 2D Vector position of the enemy game object that the player collided with from the player’s position. This will give you a vector that is the opposite direction between the player and the enemy. Add this as a force to your player’s rigidbody (ridigbody.AddForce(vector) ) to make the player bounce away. Or do the subtraction the other way around (or multiply by -1) to get the opposite force to add to the enemy to make it bounce away. It would also be worth multiplying the vector by a “bounceForce” float variable. You can then vary this to increase or decrease the bounce power.
DC