- _align
void _align()
Aligns the camera to the tracked node.
- _makeCurrent
void _makeCurrent(GodotObject arg0)
- _setCurrent
void _setCurrent(bool current)
- _updateScroll
void _updateScroll()
- clearCurrent
void clearCurrent()
Removes any Camera2D from the ancestor Viewport's internal currently-assigned camera.
- forceUpdateScroll
void forceUpdateScroll()
Forces the camera to update scroll immediately.
- getAnchorMode
Camera2D.AnchorMode getAnchorMode()
- getCameraPosition
Vector2 getCameraPosition()
Returns the camera position.
- getCameraScreenCenter
Vector2 getCameraScreenCenter()
Returns the location of the Camera2D's screen-center, relative to the origin.
- getCustomViewport
Node getCustomViewport()
- getDragMargin
double getDragMargin(long margin)
- getFollowSmoothing
double getFollowSmoothing()
- getHOffset
double getHOffset()
- getLimit
long getLimit(long margin)
- getOffset
Vector2 getOffset()
- getProcessMode
Camera2D.Camera2DProcessMode getProcessMode()
- getVOffset
double getVOffset()
- getZoom
Vector2 getZoom()
- isCurrent
bool isCurrent()
- isFollowSmoothingEnabled
bool isFollowSmoothingEnabled()
- isHDragEnabled
bool isHDragEnabled()
- isLimitDrawingEnabled
bool isLimitDrawingEnabled()
- isLimitSmoothingEnabled
bool isLimitSmoothingEnabled()
- isMarginDrawingEnabled
bool isMarginDrawingEnabled()
- isRotating
bool isRotating()
- isScreenDrawingEnabled
bool isScreenDrawingEnabled()
- isVDragEnabled
bool isVDragEnabled()
- makeCurrent
void makeCurrent()
Make this the current 2D camera for the scene (viewport and layer), in case there are many cameras in the scene.
- opAssign
typeof(null) opAssign(typeof(null) n)
- opEquals
bool opEquals(Camera2D other)
- opEquals
bool opEquals(typeof(null) n)
- resetSmoothing
void resetSmoothing()
Sets the camera's position immediately to its current smoothing destination.
This has no effect if smoothing is disabled.
- setAnchorMode
void setAnchorMode(long anchor_mode)
- setCustomViewport
void setCustomViewport(Node viewport)
- setDragMargin
void setDragMargin(long margin, double drag_margin)
- setEnableFollowSmoothing
void setEnableFollowSmoothing(bool follow_smoothing)
- setFollowSmoothing
void setFollowSmoothing(double follow_smoothing)
- setHDragEnabled
void setHDragEnabled(bool enabled)
- setHOffset
void setHOffset(double ofs)
- setLimit
void setLimit(long margin, long limit)
- setLimitDrawingEnabled
void setLimitDrawingEnabled(bool limit_drawing_enabled)
- setLimitSmoothingEnabled
void setLimitSmoothingEnabled(bool limit_smoothing_enabled)
- setMarginDrawingEnabled
void setMarginDrawingEnabled(bool margin_drawing_enabled)
- setOffset
void setOffset(Vector2 offset)
- setProcessMode
void setProcessMode(long mode)
- setRotating
void setRotating(bool rotating)
- setScreenDrawingEnabled
void setScreenDrawingEnabled(bool screen_drawing_enabled)
- setVDragEnabled
void setVDragEnabled(bool enabled)
- setVOffset
void setVOffset(double ofs)
- setZoom
void setZoom(Vector2 zoom)
- toHash
size_t toHash()
- anchorMode
Camera2D.AnchorMode anchorMode [@property getter]
long anchorMode [@property setter]
The Camera2D's anchor point. See anchormode constants.
- current
bool current [@property getter]
bool current [@property setter]
If true, the camera is the active camera for the current scene. Only one camera can be current, so setting a different camera current will disable this one.
- customViewport
Node customViewport [@property getter]
Node customViewport [@property setter]
The custom Viewport node attached to the Camera2D. If null or not a Viewport, uses the default viewport instead.
- dragMarginBottom
double dragMarginBottom [@property getter]
double dragMarginBottom [@property setter]
Bottom margin needed to drag the camera. A value of 1 makes the camera move only when reaching the edge of the screen.
- dragMarginHEnabled
bool dragMarginHEnabled [@property getter]
bool dragMarginHEnabled [@property setter]
If true, the camera only moves when reaching the horizontal drag margins. If false, the camera moves horizontally regardless of margins.
- dragMarginLeft
double dragMarginLeft [@property getter]
double dragMarginLeft [@property setter]
Left margin needed to drag the camera. A value of 1 makes the camera move only when reaching the edge of the screen.
- dragMarginRight
double dragMarginRight [@property getter]
double dragMarginRight [@property setter]
Right margin needed to drag the camera. A value of 1 makes the camera move only when reaching the edge of the screen.
- dragMarginTop
double dragMarginTop [@property getter]
double dragMarginTop [@property setter]
Top margin needed to drag the camera. A value of 1 makes the camera move only when reaching the edge of the screen.
- dragMarginVEnabled
bool dragMarginVEnabled [@property getter]
bool dragMarginVEnabled [@property setter]
If true, the camera only moves when reaching the vertical drag margins. If false, the camera moves vertically regardless of margins.
- editorDrawDragMargin
bool editorDrawDragMargin [@property getter]
bool editorDrawDragMargin [@property setter]
If true, draws the camera's drag margin rectangle in the editor.
- editorDrawLimits
bool editorDrawLimits [@property getter]
bool editorDrawLimits [@property setter]
If true, draws the camera's limits rectangle in the editor.
- editorDrawScreen
bool editorDrawScreen [@property getter]
bool editorDrawScreen [@property setter]
If true, draws the camera's screen rectangle in the editor.
- limitBottom
long limitBottom [@property getter]
long limitBottom [@property setter]
Bottom scroll limit in pixels. The camera stops moving when reaching this value.
- limitLeft
long limitLeft [@property getter]
long limitLeft [@property setter]
Left scroll limit in pixels. The camera stops moving when reaching this value.
- limitRight
long limitRight [@property getter]
long limitRight [@property setter]
Right scroll limit in pixels. The camera stops moving when reaching this value.
- limitSmoothed
bool limitSmoothed [@property getter]
bool limitSmoothed [@property setter]
If true, the camera smoothly stops when reaches its limits.
- limitTop
long limitTop [@property getter]
long limitTop [@property setter]
Top scroll limit in pixels. The camera stops moving when reaching this value.
- offset
Vector2 offset [@property getter]
Vector2 offset [@property setter]
The camera's offset, useful for looking around or camera shake animations.
- offsetH
double offsetH [@property getter]
double offsetH [@property setter]
The horizontal offset of the camera, relative to the drag margins.
Note: Offset H is used only to force offset relative to margins. It's not updated in any way if drag margins are enabled and can be used to set initial offset.
- offsetV
double offsetV [@property getter]
double offsetV [@property setter]
The vertical offset of the camera, relative to the drag margins.
Note: Used the same as offsetH.
- processMode
Camera2D.Camera2DProcessMode processMode [@property getter]
long processMode [@property setter]
The camera's process callback. See camera2dprocessmode.
- rotating
bool rotating [@property getter]
bool rotating [@property setter]
If true, the camera rotates with the target.
- smoothingEnabled
bool smoothingEnabled [@property getter]
bool smoothingEnabled [@property setter]
If true, the camera smoothly moves towards the target at smoothingSpeed.
- smoothingSpeed
double smoothingSpeed [@property getter]
double smoothingSpeed [@property setter]
Speed in pixels per second of the camera's smoothing effect when smoothingEnabled is true.
- zoom
Vector2 zoom [@property getter]
Vector2 zoom [@property setter]
The camera's zoom relative to the viewport. Values larger than Vector2(1, 1) zoom out and smaller values zoom in. For an example, use Vector2(0.5, 0.5) for a 2× zoom-in, and Vector2(4, 4) for a 4× zoom-out.
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 to get things going quickly, but more functionality may be desired to change how the camera works. To make your own custom camera node, inherit it from Node2D and change the transform of the canvas by setting Viewport.canvasTransform in Viewport (you can obtain the current Viewport by using Node.getViewport). Note that the Camera2D node's position doesn't represent the actual position of the screen, which may differ due to applied smoothing or limits. You can use getCameraScreenCenter to get the real position.