So I’m sorry this is such a basic question but for some reason I’m having difficulty with it.
I’m making a top down 2d game and I have enemies which are moving towards the player. Sometimes they overlap and get hard to distinguish which makes the player’s life more difficult. I want to make it so that when two enemies overlap they bounce away in opposite directions.
This is how the zombie moves towards the player:
tZombie.position = Vector2.MoveTowards(tZombie.position, tFort.position, Time.smoothDeltaTime);
This is the OnCollisionEnter function which is currently not printing anything on a collision (all objects which are overlapping have capsule colliders):
void OnCollisionEnter(Collision collision) {
Debug.Log("collision");
if(collision.gameObject.tag == "Zombie"){
Debug.Log("Zombie Collision");
}
}