I’m building a simple 2D space hooter in C#.
When an enemy is touched by a bullet, this happens:
void OnCollisionEnter2D(Collision2D other)
{
// If the enemy if touched by a bullet
if(other.gameObject.name == "bullet(Clone)")
// destroy the enemy
Destroy(gameObject);
}
It works. But the bullet just stops going forward because it just collided with the enemy. I’d like to see the bullet go through enemies and continue with the same velocity.
How can I do that? Thanks!