Skip to content

Components

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

FieldScript nameKindDefaultWhat it does
TexturetextureassetnoneThe id a sprite uses to display this view.
Sizesizetwo numbers (x, y), at least 1(256, 256)Size of the texture, in pixels.
Zoomzoomnumber, at least 0.011How close the view is, as a Camera's Zoom: two shows half as much.
Updateupdateone of Always, Once, Never, WhenVisibleAlwaysHow often it redraws.
SubtreesubtreecheckboxoffDraw only this node's descendants, rather than the whole scene.
LayerslayerslistemptyThe sort layers this view draws, by the number a Sort Layer holds. Empty, the default, draws them all.
Clear Colourclearcolour#000000, 0% opaqueThe colour this view is cleared to before the scene draws into it.
DrawndrawncheckboxoffWhether it has been drawn since the last time this was cleared.