I am trying to create a neuroevolution AI for flappy bird. The problem is when i create a population for 50 birds. They collide with each other at the start of the game. However i have ignored the collision through
the following code but it’s not working at the start.
private void OnCollisionEnter2D(Collision2D collision2D)
{
if (collision2D.gameObject.tag == "ignore")
{
Physics2D.IgnoreCollision(collision2D.collider, gameObject.GetComponent<Collider2D>());
return;
}
else
{
isDead = true;
anim.SetTrigger("Die");
Destroy(gameObject);
}
}