Hello my collider of bullets does not work as intended almost all bullets collide but some of them just passes in some angles any help is highly appreciated
private void OnTriggerEnter2D(Collider2D other) {
EnemyHealth enemyHealth = other.gameObject.GetComponent<EnemyHealth>();
Indestructible indestructible = other.gameObject.GetComponent<Indestructible>();
if(!other.isTrigger && (enemyHealth || indestructible))
{
Instantiate(particleOnHitVFX,transform.position,transform.rotation);
Destroy(gameObject);
}
}
it hits enemies and pass over any object as intended but sometimes goes between grid as i didnt add composite collider and continuous collision detection. Only thing i can think of is because i have 2 ontriggerenter2d on bullet object. Other one is damageresource class which basically ontrigger checks if the object is enemy and if the answer is yes damages them
private void OnTriggerEnter2D(Collider2D other) {
EnemyHealth enemyHealth = other.gameObject.GetComponent<EnemyHealth>();
enemyHealth?.TakeDamage(damageAmount, knockBackAmount);
}
Its detecting collusions as intended (First one is enemy health second one is indestructable)