Camera Zone 2D
While Target is inside Area, Camera gets Priority and the zone's zoom and bounds.
component camera.CameraZone2D
On this page
Try it
Zoom inside a camera zone
The target is inside the purple zone, so its virtual camera uses the zone's Zoom.
Change Zoom from 70 to 140 to zoom in while the target remains in the zone. Reset restores 70.
Starts the scene; open the example parameters to experiment.
Scene6 nodes
Ramp
Transform
position[0, 2]rotation0.12scale[1, 1]
Rigid Body 2D
typeenumstaticmassModeenumautomassfloat0gravityScalefloat1linearDampingfloat0angularDampingfloat0fixedRotationboolfalsebulletboolfalseallowSleepbooltrueinterpolateboolfalselayerlayer0masklayer mask-1
Wall
Transform
position[29, 2]rotation0scale[1, 1]
Rigid Body 2D
typeenumstaticmassModeenumautomassfloat0gravityScalefloat1linearDampingfloat0angularDampingfloat0fixedRotationboolfalsebulletboolfalseallowSleepbooltrueinterpolateboolfalselayerlayer0masklayer mask-1
Marker
Transform
position[0, -1]rotation0scale[1, 1]
Ball
Transform
position[0, -1]rotation0scale[1, 1]
Rigid Body 2D
typeenumstaticmassModeenumautomassfloat0gravityScalefloat1linearDampingfloat0angularDampingfloat0fixedRotationboolfalsebulletboolfalseallowSleepbooltrueinterpolatebooltruelayerlayer0masklayer mask-1
Camera
Transform
position[-20, 0]rotation0scale[1, 1]
Virtual Camera 2D
priorityint0outputstring""zoomfloat0blendTimefloat0.6blendCurveCurve{ ease=inOutQuad }timeDomainenumunscaleduseBoundsboolfalseboundsRect[0, 0, 0, 0]snapToPixelsboolfalse
Camera Follow 2D
targetNodeRefnode("d5100000000000000000000000000004")deadzoneRect[0.45, 0.4, 0.1, 0.2]dampingVec2[5, 5]lookaheadVec2[0.25, 0]maxLookaheadVec2[3, 1]lookaheadSmoothingfloat3snapDistancefloat20
Zone
Transform
position[0, -1]rotation0scale[1, 1]
Virtual Camera 2D
priorityint-1outputstring""zoomfloat0blendTimefloat0.6blendCurveCurve{ ease=inOutQuad }timeDomainenumunscaleduseBoundsboolfalseboundsRect[0, 0, 0, 0]snapToPixelsboolfalse
Fields
| Name | Type | Default | Description |
|---|---|---|---|
| Target | NodeRef | none | Node that triggers the zone. Empty uses the follow target of the zone's camera. |
| Camera | NodeRef | none | Virtual camera the zone activates. Empty uses the one on this node. |
| Priority | int | 10 | Priority of the camera while the target is inside. |
| Zoom | float | 0 | Zoom while the zone is in effect. 0 keeps the camera's zoom. ≥ 0 |
| Use Bounds | bool | false | Replaces the camera's bounds while the zone is in effect. |
| Bounds | Rect | (0, 0, 0, 0) | World rectangle used instead of the camera's bounds. |
| Area | Rect | (-4, -3, 8, 6) | Trigger rectangle in this node's space. |
Related guides
- Virtual cameras Each frame the brain picks one virtual camera per output:
- Zones Camera Zone 2D changes the camera while a target is inside its Area, a rectangle in the zone node's space.
- Cameras 2D A Camera 2D draws the view; virtual cameras decide where it looks.