- _align
void _align()
Align the camera to the tracked node
- _makeCurrent
void _makeCurrent(GodotObject arg0)
- _setCurrent
void _setCurrent(bool current)
- _setOldSmoothing
void _setOldSmoothing(double follow_smoothing)
- _updateScroll
void _updateScroll()
- clearCurrent
void clearCurrent()
Removes any Camera2D from the ancestor Viewport's internal currently-assigned camera.
- forceUpdateScroll
void forceUpdateScroll()
Force the camera to update scroll immediately.
- getAnchorMode
Camera2D.AnchorMode getAnchorMode()
- getCameraPosition
Vector2 getCameraPosition()
Return 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()
- 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's many cameras in the scene.
- opAssign
Camera2D opAssign(T n)
Undocumented in source. Be warned that the author may not have intended to support it.
- opEquals
bool opEquals(Camera2D other)
Undocumented in source. Be warned that the author may not have intended to support it.
- opEquals
bool opEquals(typeof(null) n)
Undocumented in source. Be warned that the author may not have intended to support it.
- resetSmoothing
void resetSmoothing()
Set 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(GodotObject 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)
- 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)
- anchorMode
Camera2D.AnchorMode anchorMode [@property getter]
long anchorMode [@property setter]
The Camera2D's anchor point. See ANCHOR_MODE_* 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]
GodotObject 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. Default value: true.
- 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. Default value: true.
- editorDrawDragMargin
bool editorDrawDragMargin [@property getter]
bool editorDrawDragMargin [@property setter]
If true draws the camera's drag margin rectangle in the editor. Default value: false
- editorDrawLimits
bool editorDrawLimits [@property getter]
bool editorDrawLimits [@property setter]
If true draws the camera's limits rectangle in the editor. Default value: true
- editorDrawScreen
bool editorDrawScreen [@property getter]
bool editorDrawScreen [@property setter]
If true draws the camera's screen rectangle in the editor. Default value: false
- 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. Default value: false
- 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. Default value: 0
- offsetV
double offsetV [@property getter]
double offsetV [@property setter]
The vertical offset of the camera, relative to the drag margins. Default value: 0
- rotating
bool rotating [@property getter]
bool rotating [@property setter]
If true the camera rotates with the target. Default value: false
- smoothingEnabled
bool smoothingEnabled [@property getter]
bool smoothingEnabled [@property setter]
If true the camera smoothly moves towards the target at smoothingSpeed. Default value: false
- 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 2x zoom in, and Vector2(4, 4) for a 4x 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 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.