Realot StudioDocs
Components

Camera

Realot Studio Camera component reference: fields, script API, behavior and examples.

View as Markdownllms.txt
ScopeThis page documents the Camera component in Realot Studio. Runtime fields are serialized scene data; the Script API section lists only members intentionally exposed to game scripts.
Where to find it in the editorInspector → Add Component → Camera. Main camera and scaling/presentation settings are edited in the Inspector; Play/Export use the same runtime camera path.

#What it does

Orthographic 2D camera with reference resolutions, responsive scaling, follow, shake and optional pseudo-3D sprite depth scaling.

Component setup & editor toolsCamera controls the 2D view and rendering/scaling behavior. The Scene viewport exposes a camera gizmo when a Camera entity is selected.

#How to add and use Camera

Editor path: Select the target entity in the Hierarchy (left side) → look at the Inspector (right side) → click Add Component at the bottom of the Inspector → search for Camera → click the component row. The Add Component picker is a centered modal with a search box; it only lists components not already attached.

For components with a dedicated editor tool, the tool is opened or activated from the location described below. Do not assume that adding the component alone activates its editor; some systems require a separate window, panel, or viewport tool.

#Component setup & editor tools

  • Select the Camera entity → Inspector → Camera. The Camera gizmo appears in the Scene viewport. Mark the intended camera as Main and configure projection/scaling/aspect settings in the Inspector.

#What you should see after adding it

The component appears as its own section in the Inspector. Its serialized settings are listed in the Component data table below. If a field is conditional, it appears only when the relevant mode/type is selected. If a field is a runtime state field (for example grounded or resolved velocity), treat it as read-only diagnostic state unless the API reference explicitly documents it as writable.

#How to read the settings

For every setting below, the documentation distinguishes type, default, meaning, and tuning direction where behavior is known. When a value represents a direction, use the engine's coordinate convention documented in Coordinate system; do not substitute Unity/Godot conventions.

#Component data

FieldTypePurposeDefault
backgroundColorhex color stringBackground color.#314D79
projectionstringProjection mode.Orthographic
sizenumberOrthographic camera size.5
nearClipnumberNear clip.0.3
farClipnumberFar clip.1000
isMainbooleanWhether this is the main camera.false
aspectModeCameraAspectMode enum: Landscape | Portrait | Square | CustomLandscape | Portrait | Square | Custom.Landscape
landscapeWidthnumberLandscape reference width.960
landscapeHeightnumberLandscape reference height.540
portraitWidthnumberPortrait reference width.540
portraitHeightnumberPortrait reference height.960
squareSizenumberSquare reference size.720
customWidthnumberCustom width.800
customHeightnumberCustom height.600
enablePseudo3DbooleanUse Transform.z for sprite depth scaling.false
renderToSpriteEntityIdnullable valueInspector field stored on this component.null
scalingModeScalingMode enum: Expand | Fit | Fill | Stretch── Screen scaling (device-fit) settings ────────────────────── See the ScalingMode doc comment above and computeScreenFit() in CameraUtils.js for the full picture.Fit
keepHeightbooleanEXPAND-only. true = the reference HEIGHT is what's kept exact (matches Unity's Canvas Scaler "Match: Height" — width is the axis that expands/contracts to reveal more or less of the world).true
aspectRatioLockbooleanSafety override for EXPAND specifically: Expand's whole purpose is to let the effective aspect ratio drift to match the device (showing more/less world).true
allowStretchingbooleanSafety override for STRETCH specifically: false (default) downgrades Stretch to behave like Fit instead, so a scalingMode accidentally left on "Stretch" can never actually distort the picture.false
letterboxingstringHorizontal bars (top/bottom) — shown when Fit (or a mode downgraded to Fit above) leaves vertical space unused.Auto
pillarboxingstringSame as letterboxing but for vertical bars (left/right), shown when horizontal space is left over.Auto
barColorhex color stringColor painted into letterbox/pillarbox bars when they're shown.#000000
integerScalingbooleanRounds the computed scale down to the nearest whole integer (never below 1x) before applying it — keeps pixel-art crisp instead of blurry/uneven at fractional scales.false

#Tuning behavior

These are the practical direction-of-change rules for the most important controls on this component.

SettingWhat changing it does
size / zoomFor this 2D camera, larger effective view size shows more world; increasing zoom makes the scene appear smaller/farther, while reducing it magnifies the world.
scalingModeFIT preserves the reference aspect and uses bars when necessary; FILL crops to fill; STRETCH changes aspect; EXPAND keeps the reference height and reveals more/less horizontal world.
integerScalingWhen enabled, device-fit scale is constrained toward integer multiples to keep pixel-art rendering crisp.

#Script API

MemberKindDescription
allowStretchingProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
aspectModeProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
aspectRatioLockProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
backgroundColorProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
barColorProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
customHeightProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
customWidthProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
enablePseudo3DProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
follow(entityTarget, opts)MethodThe `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
integerScalingProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
keepHeightProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
landscapeHeightProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
landscapeWidthProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
letterboxingProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
offsetXProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
offsetYProperty (read/write)Follow/render Y offset.
pillarboxingProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
portraitHeightProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
portraitWidthProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
renderToSprite(spriteEntity)MethodThe `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
scalingModeProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
shake(intensity, duration)MethodThe `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
squareSizeProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
stopFollow()MethodThe `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
xProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
yProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).
zoomProperty (read/write)The `this.camera` sub-object exposed to user scripts (see scripting/ScriptAPI.js).

#Examples

js
var cam = findFirst("Main Camera");
js
cam.camera.follow(findFirst("Target"), { smoothing: 0.1 });
Need the full workflow?Components: complete workflow covers adding, configuring, testing, combining, and removing components.