Cameras 2D
A Camera 2D draws the view; virtual cameras decide where it looks. Every Virtual Camera 2D is a candidate pose. The enabled one with the highest priority drives the view, and switching between them blends. Follow, shake and zones are components on virtual cameras; scripts trigger them.
Quick start: Create → Follow Camera gives a node with Camera 2D, Virtual Camera 2D and Camera Follow 2D. Set Target to the player and press Play.
| Component | Purpose |
|---|---|
| Virtual Camera 2D | a pose with a priority, a zoom, bounds and a blend |
| Camera Follow 2D | moves its virtual camera after a target |
| Camera Shake 2D | tunes the shake of its virtual camera |
| Camera Zone 2D | lifts a camera while a target is inside an area |
| Camera Output Selector 2D | makes a Camera 2D show another output |
Cameras run during Play and in aego run. In edit mode the Scene View shows the camera frame, the deadzone, the bounds and the zones.
Try it
Change the example parameters and compare the result. Reset restores the initial scene.
Starts the scene; open the example parameters to experiment.
Scene9 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
Post1
Transform
position[-20, -1.7]rotation0scale[1, 1]
Post2
Transform
position[-10, -0.5]rotation0scale[1, 1]
Post3
Transform
position[0, 0.7]rotation0scale[1, 1]
Post4
Transform
position[10, 1.9]rotation0scale[1, 1]
Post5
Transform
position[20, 3.1]rotation0scale[1, 1]
Ball
Transform
position[-26, -2]rotation0scale[1, 1]
Rigid Body 2D
typeenumdynamicmassModeenumautomassfloat0gravityScalefloat1linearDampingfloat0angularDampingfloat0fixedRotationboolfalsebulletboolfalseallowSleepbooltrueinterpolatebooltruelayerlayer0masklayer mask-1
Camera
Transform
position[-26, 0]rotation0scale[1, 1]
Virtual Camera 2D
priorityint0outputstring""zoomfloat0blendTimefloat0.5blendCurveCurve{ ease=inOutQuad }timeDomainenumunscaleduseBoundsboolfalseboundsRect[0, 0, 0, 0]snapToPixelsboolfalse
Camera Follow 2D
targetNodeRefnode("d5000000000000000000000000000008")deadzoneRect[0.4, 0.4, 0.2, 0.2]dampingVec2[4, 4]lookaheadVec2[0.3, 0]maxLookaheadVec2[3, 1]lookaheadSmoothingfloat3snapDistancefloat20
- Virtual cameras Each frame the brain picks one virtual camera per output:
- Outputs Virtual cameras drive the main output unless Output names another one.
- Follow Camera Follow 2D moves its virtual camera after Target.
- Zones Camera Zone 2D changes the camera while a target is inside its Area, a rectangle in the zone node's space.
- Shake In Try it, the crate drops every two seconds and its script calls
camera.Shake(0.9)when it lands. - Time and replays Time Domain decides how blends and shake of the active camera count time.
- Scripting
BlendhasDone(),Running(),Stop()and the signalCompleted(finished bool);yieldwaits for it. - Editor tools The editor draws camera frames, deadzones and zones, and shows the state of the active camera during Play.
- Go
ServicehasActive,BlendTo,Release,Shake,Trauma,Logical,Render,ViewandSnap, all keyed by output name;""is the main output.