Triggers are being activated by playerController when the Controller is already inside the trigger.

Hi all-- This is a bit of an odd one. I’ve spent a few days trying to figure it out. The game is 2D but it’s still using the 3d physics engine. My character can shoot a gun. So let’s take a sliding door as an example of this trigger problem–it affects all triggers. When the player enters the trigger–the door opens. When the player leaves the trigger, the door closes. Simple and to the point. The issue–whenever the player fires the gun–the onTriggerEnter, and onTriggerExit IMMEDIATELY activate back to back and the door will open and close while the player is still within the trigger space–never having left it.

The only thing I can decipher–is Instantiating something (a bullet) from the player controls script causes the controller’s collider to reset? The triggers are activated by a SendMessage(ActivateTrigger) --ActivateTrigger being my custom script the trigger objects–like doors–share. Only the player script has functions that SendMessage with Activate Trigger – so the problem has to be with the player.

Things I know: The same effect occurs when I resize the characterController’s capsule collider in the editor window – shooting a bullet doesn’t resize the characterController.

Okay–I figured it out. It’s a little weird–and potentially a bug? Can someone please tell me whether or not I should report it?

Physics.IgnoreCollision(GetComponent<Collider>(), playerObject.GetComponent<Collider>());	

Here’s the culprit. When the bullet is instantiated, it makes a physics call to ignore the player’s collider in Awake(). When that is commented out–problem solved. What I’m guessing is happening is that the Physics.IgnoreCollision() function temporarily disables the colliders given as parameters, runs some physx code on them, and then re-enables them in the background of Unity–the effect is that if a player controller’s collider is within a Trigger box --e.g. after OnTriggerEnter is called but before OnTriggerExit is called – the physics function disables the player collider which triggers an OnTriggerExit, and then renables the collider which triggers an OnTriggerEnter.

That seems like a bug to me–but maybe that’s just how it’s supposed to act?