Camera
From a script
ts
import { CameraComponent } from "mmpx";
const camera = this.entity.TryGetComponent(CameraComponent);Full API: CameraComponent.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
Projectionprojection | "orthographic" | "perspective" | "orthographic" | |
Fit CanvasfitCanvas | boolean | true | Frame a Canvas: the ortho size follows its reference size and scale mode. Off = use Ortho Size (zoom). |
Canvascanvas | Canvas | — | Which Canvas to frame — empty = the scene's first Canvas |
Ortho SizeorthographicSize | number (0.001 … ∞) | 540 | Half the visible height, in world units |
Field Of ViewfieldOfView | number (1 … 179) (°) | 60 | |
VisibilitycullingMask | layer mask | Everything | Layers this camera renders |
Prioritydepth | number | 0 | Higher renders later (on top) |
Post EffectspostMaterials | list of material assets | [] | Post-domain materials applied to everything this camera draws, in order |
Clear
| Field | Type | Default | Description |
|---|---|---|---|
FlagsclearFlags | "solid-color" | "depth-only" | "dont-clear" | "solid-color" | |
ColorclearColor | colour | #000000 | |
AlphaclearAlpha | number (0 … 1) | 1 |
Viewport
| Field | Type | Default | Description |
|---|---|---|---|
Viewport XviewportX | number (0 … 1) | 0 | Screen fractions from the top-left (screen space is y-down) |
Viewport YviewportY | number (0 … 1) | 0 | |
Viewport WidthviewportWidth | number (0 … 1) | 1 | |
Viewport HeightviewportHeight | number (0 … 1) | 1 | |
ClipclipToViewport | boolean | true |
Advanced
| Field | Type | Default | Description |
|---|---|---|---|
Near ClipnearClip | number | -1000 | |
Far ClipfarClip | number | 1000 | |
Target TexturetargetTexture | renderTexture asset | — | Draw into this render texture instead of the screen |