Camera node for 2D scenes.
Camera node for 2D scenes. It forces the screen (current layer) to scroll following this node. This makes it easier (and faster) to program scrollable scenes than manually changing the position of [CanvasItem] based nodes.
This node is intended to be a simple helper get get things going quickly and it may happen often that more functionality is desired to change how the camera works. To make your own custom camera node, simply inherit from [Node2D] and change the transform of the canvas by calling get_viewport().set_canvas_transform(m) in [Viewport].
Align the camera to the tracked node
Force the camera to update scroll immediately.
Return the camera position.
Return the margins needed to drag the camera (see [method set_drag_margin]).
Return the scrolling limit in pixels.
Return the scroll offset.
Return true of this is the current camera (see [method make_current]).
Make this the current 2D camera for the scene (viewport and layer), in case there's many cameras in the scene.
Set the camera's position immediately to its current smoothing destination.
This has no effect if smoothing is disabled.
Set the margins needed to drag the camera (relative to the screen size). Margin uses the MARGIN_* enum. Drag margins of 0,0,0,0 will keep the camera at the center of the screen, while drag margins of 1,1,1,1 will only move when the camera is at the edges.
Set the scrolling limit in pixels.
Smooth camera when reaching camera limits.
This requires camera smoothing being enabled to have a noticeable effect.
Set the scroll offset. Useful for looking around or camera shake animations.