I currently have a car that is a rigidbody with three child colliders in the shape of the car. How can I make it so that they act as one collider and take damage only once instead of three times when hit by an object that is a trigger?
For example, if one of the hazards of my game is a flame wall, and I drive through it, I take damage three times due to having three colliders on the car. But I only want it to take damage once.
I did some searches but they were projectile related where it can use a boolean variable to see if it hit something, and if it did, to not do send the message to take damage again. Since the flame wall is not a projectile, it will always be active and not destroyed. So if I used a boolean variable I would need a way to set it back to false when the player leaves the flame wall. So when the player enters again, it does damage again. The problem with setting the boolean back to false with OnTriggerExit() is that it does this even if just one of the three colliders exit the flame wall trigger, but I don’t want it to set to false until all three colliders exit the flame wall trigger.
Due to the nature of a flame wall, the player should also take damage over time while staying in there, but again, it would do damage three times due to having three colliders on the car.
Is there a way to make the three colliders on the car really act as one collider for taking damage purposes?