Triggers create but never destroy contacts.

Hi,

I've set up a simple scene with some rigid bodies and a trigger zone. I'm watching the physics output in the profiler and the 'Number of Contacts' goes up by 1 when a rigid body enters the trigger zone. What gets me is the number of contacts is not reduced when the rigid body exits the trigger zone.

The result is there eventually accumulates hundreds of contacts (according to the profiler). Is this normal or is something strange going on here?

No code required. Create a new scene, add a trigger zone and place a rigidbody above it. Let gravity pull the rigidbody through the trigger. Watch the profiler and you'll see the number of contacts will go from 0 to 1 and never return to 0.

I see this in the editor all the time - if a rigidbody has a trigger region and a hard collider overlapping (e.g. a player neighborhood trigger around the player body) the profiler shows an ever-increasing contact leak every fixed update.

1 Answer

1

I’m observer the same thing in my game… Does this mean the contact points are leaking? or is it just a number indicating the number of contacts that occured so far?

I have no idea. It's a question best answered by the Unity guys.