Repository navigation
API Class Camera
Defined in: src/engine/render/components.ts:159
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/components.ts:170
Clear color; null uses the project's display background color.
depth: number = 0;Defined in: src/engine/render/components.ts:168
Cameras render in ascending depth order.
far: number = 1000;Defined in: src/engine/render/components.ts:166
fieldOfView: number = 60;Defined in: src/engine/render/components.ts:164
Vertical field of view in degrees (perspective).
near: number = 0.1;Defined in: src/engine/render/components.ts:165
orthographicSize: number = 5;Defined in: src/engine/render/components.ts:162
Half the vertical view size in world units (orthographic).
pixelPerfect: boolean = false;Defined in: src/engine/render/components.ts:183
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/components.ts:185
With pixelPerfect on, sprites' world positions snap to the texel grid (1 / pixelsPerUnit units) when drawn.
projection: Projection = "orthographic";Defined in: src/engine/render/components.ts:160
targetTexture: string = "";Defined in: src/engine/render/components.ts:191
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.
viewportPosition: Vector2;Defined in: src/engine/render/components.ts:175
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/components.ts:177
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/components.ts:225
Width / height of the camera's viewport rectangle on the canvas (ADR 0073).
number
get enabled(): boolean;Defined in: src/engine/core/Component.ts:57
boolean
set enabled(value): void;Defined in: src/engine/core/Component.ts:61
boolean
void
get gameObject(): GameObject;Defined in: src/engine/core/Component.ts:37
Unity-style alias for node.
get isActiveAndEnabled(): boolean;Defined in: src/engine/core/Component.ts:68
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:32
The node this component is on.
get owner(): GameObject;Defined in: src/engine/core/Component.ts:45
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:93
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:51
The Transform of the node this component is on, if it has one.
get world(): WorldHandle;Defined in: src/engine/core/Component.ts:82
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/components.ts:194
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:103
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/components.ts:291
The world ray through a canvas point in pixels, origin top-left, as Input.mousePosition
(ADR 0073). 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/components.ts:297
Like screenPointToRay, from viewport coordinates 0 to 1 with the origin bottom-left, as in Unity.
worldToScreenPoint(p): Vector3;Defined in: src/engine/render/components.ts:306
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).
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