Umm, I’m having some issues with triggers and colliders.
I decided to use multiple collider on enemy (A and B) so that I could have more complex damage detection than single collider with better performance than mesh collider. It worked well when I shoot a bullet which has small collider (single enemy damaged once every single bullet hit). But didn’t work for bigger trigger damage source.
When a bomb (C) explodes and activate it’s trigger, single enemy can be damaged multiple times because OnTriggerEnter on the bomb’s script is called for every single parts of the enemy that inside the trigger (then I realize that this can also happen if the bullet has a big collider). The expected outcome is that an enemy damaged once for a single explosion source.
The flow is: a bomb with disabled trigger detonates when it hit the ground and enables it’s trigger, the monobehaviour on the bomb call OnTriggerEnter and get the enemy script on the triggered enemy (parts) and then call the Hit method on enemy monobehaviour.
The solution that came in mind is that the OnTriggerEnter on the bomb flag an “isDamage” bool and send the damage int to the enemy monobehaviour without do the damage calculation and then the enemy do the damage calculation every update (and re-flag the bool so that there can only be one damage for every frame). Isn’t this a bit difficult? Am I missing something obvious or some basic workaround?
