Move object after collision

Hello all,

I have 2 objects: the player and an enemy. The enemy is chasing the player and every time it hits the player, he will take damage. Everything is working as intended but I'm trying to "trow" the player backwards after the collision. How to do it? I can trow the player to any position, but I'm trying to figure how to throw him to the direction the enemy is facing, not where the player is facing. (This is needed because if the enemy hits the player, it usually hit 2-3 times before the player can move away from it).

Thanks for the help!!

You can use enemy.forward to get the forward direction of the enemy. Of course you need to create the enemy variable (passed to you in your collision code).

function OnTriggerEnter(other : Collider)
{
    if (other.CompareTag("Enemy"))
    {
        var enemy = other.transform;
        ThrowDirection(enemy.forward);
    }
}

This assumes you have a function called ThrowDirection. I am sure you can work out how to adapt it to your script.