Repository navigation
API Class Camera
Defined in: src/engine/render/camera.ts:18
Renders the scene from its node's position, looking along +Z (left-handed, ADR 0164).
new Camera(): Camera;Camera
backgroundColor: Color | null = null;Defined in: src/engine/render/camera.ts:29
Clear color; null uses the project's display background color.
depth: number = 0;Defined in: src/engine/render/camera.ts:27
Cameras render in ascending depth order.
far: number = 1000;Defined in: src/engine/render/camera.ts:25
fieldOfView: number = 60;Defined in: src/engine/render/camera.ts:23
Vertical field of view in degrees (perspective).
near: number = 0.1;Defined in: src/engine/render/camera.ts:24
occlusionCulling: boolean = true;Defined in: src/engine/render/camera.ts:59
Skip drawing objects hidden behind others (ADR 0543 §4). Takes effect for perspective cameras drawing to the canvas
only: orthographic and render-texture cameras never occlusion-cull, and the quality tier can turn it off for every
camera (occlusionBuffer).
orthographicSize: number = 5;Defined in: src/engine/render/camera.ts:21
Half the vertical view size in world units (orthographic).
pixelPerfect: boolean = false;Defined in: src/engine/render/camera.ts:42
Orthographic only. Zooms the view by a whole number so each sprite texel covers an integer
number of screen (device) pixels, and snaps the camera's position to that pixel grid (ADR 0014).
orthographicSize becomes the minimum half-height wanted.
pixelSnapping: boolean = true;Defined in: src/engine/render/camera.ts:44
With pixelPerfect on, sprites' world positions snap to the texel grid (1 / pixelsPerUnit units) when drawn.
projection: Projection = "orthographic";Defined in: src/engine/render/camera.ts:19
targetTexture: string = "";Defined in: src/engine/render/camera.ts:52
A render texture asset (*.rendertexture.json, ADR 0109) to draw into instead of the canvas.
Materials, sprites and UI images that name the same asset show what the camera sees (a frame
later: cameras drawing into textures draw after the ones on the canvas). Empty: the canvas.
A camera drawing into a texture draws on the texture's pixels, ignoring its viewport rectangle: its
aspect, rays and screen points are the texture's (pixels from its top-left), as in Unity (ADR 0558).
viewportPosition: Vector2;Defined in: src/engine/render/camera.ts:34
The camera's rectangle on the canvas: the bottom-left corner as fractions of the canvas, like Unity's Viewport Rect (ADR 0056). The default 0,0 / 1,1 covers the whole canvas.
viewportSize: Vector2;Defined in: src/engine/render/camera.ts:36
The camera's rectangle on the canvas: its width and height as fractions of the canvas (ADR 0056).
get aspect(): number;Defined in: src/engine/render/camera.ts:99
Width / height of what the camera draws: its viewport rectangle on the canvas, or its render texture (ADR 0073, 0558). The renderer draws at this aspect.
number
get enabled(): boolean;Defined in: src/engine/core/Component.ts:62
boolean
set enabled(value): void;Defined in: src/engine/core/Component.ts:66
boolean
void
get gameObject(): GameObject;Defined in: src/engine/core/Component.ts:42
Unity-style alias for node.
get isActiveAndEnabled(): boolean;Defined in: src/engine/core/Component.ts:73
True when enabled, the node is active in the hierarchy, and the node is in a loaded world.
boolean
get node(): GameObject;Defined in: src/engine/core/Component.ts:37
The node this component is on.
get owner(): GameObject;Defined in: src/engine/core/Component.ts:50
The node this component acts for: the node itself when attached directly, or the parent node when this component lives on a component node (ADR 0009).
get time(): Readonly<TimeState>;Defined in: src/engine/core/Component.ts:98
This component's World's clock (ADR 0032): the same values as Time, but safe to read
outside the World's frame too (after an await, say).
Readonly<TimeState>
get transform(): Transform;Defined in: src/engine/core/Component.ts:56
The Transform of the node this component is on, if it has one.
get world(): WorldHandle;Defined in: src/engine/core/Component.ts:87
A handle on this component's World (ADR 0132): the same one Engine.findWorld returns. Load
a scene into it, pause, connect or destroy it: this.world.loadScene("scenes/level2.scene.json").
Throws for a World no Engine owns.
get static main(): Camera | null;Defined in: src/engine/render/camera.ts:62
The enabled camera with the lowest depth in the current World (ADR 0032).
Camera | null
instantiate(prefabPath, options?): GameObject;Defined in: src/engine/core/Component.ts:108
Instantiate a prefab in this component's World (ADR 0034), like GameObject.instantiate.
Use it in code that may run after an await: by then the frame is over and the current World
is the Engine's default one, which may not be this component's. A parent from another
World throws.
string
InstantiateOptions = {}
screenPointToRay(point): Ray;Defined in: src/engine/render/camera.ts:176
The world ray through a canvas point in pixels, origin top-left, as Input.mousePosition
(ADR 0073); for a camera drawing into a render texture, a point in the texture's pixels (ADR 0558). Perspective rays start at the camera; orthographic rays are parallel to its view
direction and start on the camera's plane.
viewportPointToRay(point): Ray;Defined in: src/engine/render/camera.ts:182
Like screenPointToRay, from viewport coordinates 0 to 1 with the origin bottom-left, as in Unity.
worldToScreenPoint(p): Vector3;Defined in: src/engine/render/camera.ts:192
A world point's place on the canvas: x and y in pixels (origin top-left, like
Input.mousePosition), z the distance in front of the camera along its view direction (negative
means behind it, where x and y are mirrored and not meaningful) (ADR 0073). A camera drawing into a
render texture answers in the texture's pixels (ADR 0558).
This wiki is generated from docs/wiki/ and the myco module's source on every push to master. Change pages there in a pull request: edits made here are not kept.
Basics
Gameplay
Rendering
Audio
- Playing sound
- Why is there no sound?
- Playlists
- Interactive music
- Sound generators
- Spatial audio
- Audio mixer
- Live mixing
- Loudness
- Audio profiler
- Audio takes
Reference