[Cinemachine] Fix Camera Movement Stopping with CinemachineConfiner2D
Solution
Unity 2021.x - Unity 6.3.x
Published Sat, May 9
A CinemachineVirtualCamera ceases all movement upon the addition of a CinemachineConfiner2D component, even when the Bounding Shape 2D extends beyond the camera's intended movement area.
The Bounding Shape 2D must reference an active Collider2D with Is Trigger enabled. Invalidate the cache to ensure the CinemachineConfiner2D recognizes geometry updates.
The cessation of movement in a CinemachineVirtualCamera after adding a CinemachineConfiner2D component typically indicates that the Bounding Shape 2D is improperly calculated or the camera is being forced to a single valid point at the boundary edge.
To resolve this configuration issue:
- Locate the
CinemachineConfiner2Dextension on your virtual camera GameObject. - Verify that the Bounding Shape 2D field is assigned to a GameObject containing a
PolygonCollider2D,CompositeCollider2D, orBoxCollider2D. - Enable the
Is Triggerproperty on the assignedCollider2Dto prevent physics-based displacement. - Click the
Invalidate Cachebutton on the component to refresh the internal geometry data. - Ensure the
Collider2Dis not disabled and the GameObject it resides on is active.
Additional Tips
- If ‘Confine Screen Edges’ is enabled, the Bounding Shape 2D must be larger than the orthographic frustum of the camera.
- Ensure the
Collider2Dis on an active GameObject and not hidden by a layer mask that the confiner ignores. - For
CompositeCollider2D, confirm that theGeometry Typeis set toPolygonsrather thanOutlinesfor correct volume detection.
Related Posts Haven't quite found a solution to your problem? We think these posts might help you.
Content inspired by a Unity discussion post.