Skip to content

Camera2D

Eduard Gushchin edited this page Jul 1, 2026 · 5 revisions

Home | API by Category | Complete API Index | API Compatibility

Field Value
Full name Electron2D.Camera2D
Namespace Electron2D
Kind class
Category Rendering

Overview

Provides the Electron2D 2D camera node for selecting the visible canvas region.

Syntax

public class Electron2D.Camera2D : Electron2D.Node2D

Godot 4.7 C# profile compatibility

Profile: Electron2D 0.1.0 2D
Status: Partial / Not verified
Out of profile: yes
Godot reference: Camera2D

Current 2D camera selection, target/center/rotation queries, offset, zoom and documented smoothing no-op baseline.

Remarks

Camera2D can become current on the nearest ancestor Electron2D.Viewport. Electron2D 0.1.0 Preview implements target position, offset, zoom and rotation behavior; camera limits, drag margins and smoothing are intentionally not implemented yet.

Thread Safety

This type is not synchronized. Create and mutate cameras on the main scene thread.

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Viewport

Members

Member Kind Summary
Enabled Property Gets or sets whether this camera can become current.
IgnoreRotation Property Gets or sets whether the camera ignores its node rotation.
Offset Property Gets or sets the camera target offset.
Zoom Property Gets or sets the camera zoom.
Electron2D.Camera2D() Constructor Initializes a new instance of the Camera2D type.
Align() Method Aligns the camera to the tracked position.
ClearCurrent(System.Boolean) Method Clears this camera as the current camera on its viewport.
ForceUpdateScroll() Method Forces the camera scroll state to update immediately.
GetScreenCenterPosition() Method Gets the screen center position in global coordinates.
GetScreenRotation() Method Gets the camera screen rotation in radians.
GetTargetPosition() Method Gets the camera target position in global coordinates.
IsCurrent() Method Checks whether this camera is current on its viewport.
MakeCurrent() Method Makes this camera current on the nearest ancestor viewport.
ResetSmoothing() Method Resets camera smoothing state.
_EnterTree() Method Called when this node enters a scene tree.
_ExitTree() Method Called when this node exits a scene tree.

Member Details

Enabled

Kind: Property

public System.Boolean Enabled { get; set; }

Summary

Gets or sets whether this camera can become current.

Remarks

When the current camera is disabled, its viewport clears the current camera and may select another enabled camera when requested by Electron2D.Camera2D.ClearCurrent(System.Boolean).

Value

The current enabled value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Camera2D

IgnoreRotation

Kind: Property

public System.Boolean IgnoreRotation { get; set; }

Summary

Gets or sets whether the camera ignores its node rotation.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current ignore rotation value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Camera2D

Offset

Kind: Property

public Electron2D.Vector2 Offset { get; set; }

Summary

Gets or sets the camera target offset.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current offset value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Camera2D

Zoom

Kind: Property

public Electron2D.Vector2 Zoom { get; set; }

Summary

Gets or sets the camera zoom.

Remarks

Higher values zoom in. Each component must be finite and non-zero.

Value

The current zoom value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Camera2D

Electron2D.Camera2D()

Kind: Constructor

public Electron2D.Camera2D()

Summary

Initializes a new instance of the Camera2D type.

Remarks

The new instance follows the lifetime and validation rules of its declaring type.

Thread Safety

This member is not synchronized. Call it from the thread that owns the related object unless the declaring type states otherwise.

Since

This API is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Camera2D

Align()

Kind: Method

public System.Void Align()()

Summary

Aligns the camera to the tracked position.

Remarks

This is a no-op in Electron2D 0.1.0 Preview because camera smoothing and drag margins are not implemented yet.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Camera2D

ClearCurrent(System.Boolean)

Kind: Method

public System.Void ClearCurrent(System.Boolean)(System.Boolean enableNext)

Summary

Clears this camera as the current camera on its viewport.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • enableNext: If true, the viewport selects the first enabled camera in tree order after this camera is cleared.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Camera2D

ForceUpdateScroll()

Kind: Method

public System.Void ForceUpdateScroll()()

Summary

Forces the camera scroll state to update immediately.

Remarks

This is a no-op in Electron2D 0.1.0 Preview because smoothing state is not implemented yet.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Camera2D

GetScreenCenterPosition()

Kind: Method

public Electron2D.Vector2 GetScreenCenterPosition()()

Summary

Gets the screen center position in global coordinates.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Returns

The camera target position for the 0.1.0 Preview baseline.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Camera2D.GetTargetPosition

GetScreenRotation()

Kind: Method

public System.Single GetScreenRotation()()

Summary

Gets the camera screen rotation in radians.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Returns

0 when Electron2D.Camera2D.IgnoreRotation is true; otherwise, Electron2D.Node2D.GlobalRotation.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Camera2D

GetTargetPosition()

Kind: Method

public Electron2D.Vector2 GetTargetPosition()()

Summary

Gets the camera target position in global coordinates.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Returns

Electron2D.Node2D.GlobalPosition plus Electron2D.Camera2D.Offset.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Camera2D

IsCurrent()

Kind: Method

public System.Boolean IsCurrent()()

Summary

Checks whether this camera is current on its viewport.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Returns

true if this camera is the active 2D camera; otherwise, false.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Camera2D

MakeCurrent()

Kind: Method

public System.Void MakeCurrent()()

Summary

Makes this camera current on the nearest ancestor viewport.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Exceptions

  • System.InvalidOperationException: Thrown when the camera is not a descendant of a Electron2D.Viewport.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Camera2D

ResetSmoothing()

Kind: Method

public System.Void ResetSmoothing()()

Summary

Resets camera smoothing state.

Remarks

This is a no-op in Electron2D 0.1.0 Preview because smoothing state is not implemented yet.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Camera2D

_EnterTree()

Kind: Method

public System.Void _EnterTree()()

Summary

Called when this node enters a scene tree.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Thread Safety

This member is not synchronized. Call it from the thread that owns the related object unless the declaring type states otherwise.

Since

This API is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Camera2D

_ExitTree()

Kind: Method

public System.Void _ExitTree()()

Summary

Called when this node exits a scene tree.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Thread Safety

This member is not synchronized. Call it from the thread that owns the related object unless the declaring type states otherwise.

Since

This API is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Camera2D

Clone this wiki locally