ImI am making a melee attack with my game, but ImI'm stuck in a problem related to using triggers. My AIThe enemy NPCs have a sphere collider set on trigger so I will know who is inside histheir range ( radiusradius of 15).
Then, then a madeI wrote a simple OnTriggerEnter script to make that when my sword (theits collider is set to trigger as well, so it will pass through the enemy) hits an enemy NPC, it will destroy thethat enemy, but. The problem is that when I try to test it, the enemyenemies are destroydestroyed once I enter thetheir sphere collider.
So, is there a way to ignore the trigger from their shpere collider? Or what is the best way to do a melee attack?
NOTE: the destroy function is public in the enemy script and it was called in weapon script attached to the weapon.