Camera
The view a room is seen through. Only one should be active in a scene at a time, and it decides magnification, roll and how the visible area scales with the window.
On this page
Add it
+ Add node → Camera, Pixel Perfect Camera, Camera Rig creates a node with it already on. Already have a node for it? Add component → CameraComponent.
From a script
A script on the same node writes these fields by name. CameraComponent is the name to pass.
rgs
set_flag("CameraComponent", "active", true);
set_number("CameraComponent", "zoom", 1.0);
set_number("CameraComponent", "rotation", 0.0);
set_point("CameraComponent", "offset", vec2(0.0, 0.0));
set_number("CameraComponent", "extent", 360.0);
set_number("CameraComponent", "width", 640.0);
set_flag("CameraComponent", "pixel_snap", true);
set_colour("CameraComponent", "background", vec4(0.0021246888, 0.0033465356, 0.0033465356, 1.0)); Fields
| Field | Script name | Kind | Default | What it does |
|---|---|---|---|---|
| Active | active | checkbox | on | Whether this camera drives the view. |
| Zoom | zoom | number, 0.01 to 64, step 0.01 | 1 | Magnification. Greater than one zooms in. |
| Rotation | rotation | number, step 1 | 0 ° | Dutch angle; zero is level. |
| Offset | offset | two numbers (x, y) | (0, 0) | Moves the picture without moving the camera: what a script's camera_view() sees and the room's confiner stay where the camera rests. A script's shake() is drawn on top and never written here. |
| Scaling | scaling | one of Pixels, FixedVertical, FixedHorizontal, Letterbox | Pixels | How the camera works out how much of the world to show. |
| Extent | extent | number, at least 1 | 360 u | How much of the world the view shows: its height for Fixed Vertical and Letterbox, its width for Fixed Horizontal. |
| Width | width | number, at least 1 | 640 u | How wide the view is when Scaling is set to Letterbox. |
| Pixel Snap | pixel_snap | checkbox | on | Stops pixel art shimmering as the camera moves. |
| Background | background | colour | #010101 | The colour behind everything this camera shows, and in the bars of a Letterbox; always drawn fully opaque. |