Viewport
Draws the whole scene, or just this node's own subtree, again into a texture: a minimap, a security camera, a portal, a picture-in-picture. The node is the camera — move it and the view moves.
On this page
Add it
+ Add node → Viewport creates a node with it already on. Already have a node for it? Add component → ViewportComponent.
From a script
A script on the same node writes these fields by name. ViewportComponent is the name to pass.
rgs
set_point("ViewportComponent", "size", vec2(256.0, 256.0));
set_number("ViewportComponent", "zoom", 1.0);
set_flag("ViewportComponent", "subtree", false);
set_colour("ViewportComponent", "clear", vec4(0.0, 0.0, 0.0, 0.0));
set_flag("ViewportComponent", "drawn", false); Fields
| Field | Script name | Kind | Default | What it does |
|---|---|---|---|---|
| Texture | texture | asset | none | The id a sprite uses to display this view. |
| Size | size | two numbers (x, y), at least 1 | (256, 256) | Size of the texture, in pixels. |
| Zoom | zoom | number, at least 0.01 | 1 | How close the view is, as a Camera's Zoom: two shows half as much. |
| Update | update | one of Always, Once, Never, WhenVisible | Always | How often it redraws. |
| Subtree | subtree | checkbox | off | Draw only this node's descendants, rather than the whole scene. |
| Layers | layers | list | empty | The sort layers this view draws, by the number a Sort Layer holds. Empty, the default, draws them all. |
| Clear Colour | clear | colour | #000000, 0% opaque | The colour this view is cleared to before the scene draws into it. |
| Drawn | drawn | checkbox | off | Whether it has been drawn since the last time this was cleared. |