[Top Down Shooter] Make bullets pass through some gameobjects

Hi,

Thanks for reading. My game has two factions: (player + allies) & enemies. I would like to make it so bullets which hit members of the same faction pass through them. At present, if a bullet hits a member of the same faction, it ‘curls’ around it. I tried hiding the bullet and its trail renderer, but the problem is more that the bullets go off course than appearance of it curling around the gameobject.

Bullets have rigidbodies, as do the members of all factions. If you need more info, please let me know!

// If the bullet collides with an enemy
if(Other.gameObject.tag == "Enemy")
{
    // Get the script of the hit enemy
    EnemyScript es = (EnemyScript) Other.gameObject.GetComponent("EnemyScript");
				
    // Damage enemy
}
				
// If the object is not an enemy, hide the bullet
else if(Other.gameObject.tag == "Ally")
{		
    HideBullet();
}

Read this

You’ll want to put separate factions on separate collision layers. This is the easiest way to achieve this manner of things IMO.