Cinemachine Confiner : weird behaviour when the collider is disabled

So I got stuck a while with this :
I was trying to confine a camera in a room with a polygon collider attached to an empty GameObject. However, in order not to make the player collide with it, I could have checked “isTrigger”, but I tried instead to disable the collider. Aaaand actually the camera has REALLY weird behaviour in this configuration.
When “confine screen edges” is checked, the camera jumps to edges when it is near them, and when “confine screen edges” is false, the screen is upside down…

After changing all parameters, one after another, I found that the problem was disabling the collider.

So maybe an error message when the collider is disabled could be useful.

Thanks for reporting the issue.
The reason why the confiner behaves weird when the collider is disabled is that we are checking if the collider overlaps the camera (OverlapPoint). Unfortunately, when the collider is disabled, OverlapPoint always returns false. This causes the algorithm to think that we are on the edge or outside of the collider.

That’s a good point. The confiner will behave in this case as if the collider was set to null! :wink:

You can also put your colliders on layers, see https://docs.unity3d.com/Manual/LayerBasedCollision.html.