https://gyazo.com/6decc03820f75cca2ce8fe0c9cd17311
The ideal would be for it to work like this, right now this is the code:
private void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.CompareTag("Enemy"))
{
Vector3 perpVector = Vector3.Cross(rb.velocity, Vector3.forward);
Vector2 pushDirection = new Vector2(perpVector.x, perpVector.y).normalized;
Debug.Log("Direction:" + pushDirection);
collision.gameObject.GetComponent<Rigidbody2D>().velocity = pushDirection * pushForce;
}
}```
and the object is pushed away in a clockwise direction, if collided from the left side he will be pushed down, etc