Skip to reading
GDScript Programming & Godot

Set2DCamera()

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page

Set 2D Camera

Set the 2D camera's position, zoom and rotation for a scene.

Source table from Set2DCamera(), page 151
Option key / fieldMeaning and inputDefault
Room (empty = current) sceneIdChoose a scene ID. May be blank.Blank
Camera Position XY position2D position as [X, Y].[0.0, 0.0]
Camera Zoom XY zoom[X, Y] numeric array.[1.0, 1.0]
Camera Rotation (degrees) rotation2D camera rotation angle; follow the field label for its units.0.0

Timing. Waits for the runtime routine to return; no further completion wait is promised by this schema.

Code example
await Set2DCamera({"sceneId": "lab", "position": [0.0, 0.0], "zoom": [1.0, 1.0]})

In use. Zoom a painted-room view to [1.25,1.25]. This acts on the 2D camera system; it does not change a 3D perspective camera's field of view. Keep both zoom values above zero.

Page 151 of 378Permalink
Go to page