VaelisDocs
v1.0.0
Components · v1.0.0

Camera

Vaelis 1.0.0 Camera component reference: fields, script API, behavior and examples.

View as Markdownllms.txt
ScopeThis page documents the Camera component in Vaelis 1.0.0. 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 stringBackground color.#314D79
projectionstringProjection mode.Orthographic
sizenumberOrthographic camera size.5
nearClipnumberNear clip.0.3
farClipnumberFar clip.1000
isMainbooleanWhether this is the main camera.false
aspectModeenumLandscape | 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
renderToSpriteEntityIdstring | nullSee the Inspector field of the same name.null
scalingModeenumExpand | Fit | Fill | Stretch.Fit
keepHeightbooleanAxis choice used by Expand mode.true
aspectRatioLockbooleanLock aspect ratio.true
allowStretchingbooleanAllow distortion where applicable.false
letterboxingenumAuto | On | Off.Auto
pillarboxingenumAuto | On | Off.Auto
barColorhex stringLetterbox/pillarbox color.#000000
integerScalingbooleanUse integer scaling.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
zoomPropertyCamera zoom/scale control.
backgroundColorPropertyBackground color.
shake(intensity,duration)MethodCamera shake.
follow(target, options)MethodFollow an entity; options can include smoothing.
stopFollow()MethodStop following.
offsetXPropertyFollow/render X offset.
offsetYPropertyFollow/render Y offset.
renderToSprite(spriteEntity)MethodRender camera output to a sprite target.
aspectModePropertyLandscape | Portrait | Square | Custom.
landscapeWidthPropertyLandscape reference width.
landscapeHeightPropertyLandscape reference height.
portraitWidthPropertyPortrait reference width.
portraitHeightPropertyPortrait reference height.
squareSizePropertySquare reference size.
customWidthPropertyCustom width.
customHeightPropertyCustom height.
enablePseudo3DPropertyEnable Transform.z-based sprite depth scaling.
scalingModePropertyExpand | Fit | Fill | Stretch.
keepHeightPropertyExpand axis behavior.
aspectRatioLockPropertyAspect lock.
allowStretchingPropertyAllow stretching.
letterboxingPropertyAuto | On | Off.
pillarboxingPropertyAuto | On | Off.
barColorPropertyBar color.
integerScalingPropertyInteger scaling.
xPropertyCamera world-space X position (same as this.x on the camera entity).
yPropertyCamera world-space Y position (same as this.y on the camera entity).

#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.