Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit8d45df8664

README.md

ecs.Camera

Spec for the Camera component, which maps to the native Camera. Makes an entity a render viewpoint, with a configurable projection, render priority, layer selection, and an optional offscreen render target.

Fields

  • enabled — whether the camera renders.
  • fov, near, far — perspective projection parameters.
  • priority — orders multiple cameras.
  • textureHandle — a renderer.texture.create({ width, height }) handle the camera renders into; absent means the main viewport.
  • layerIncludeMask — render-layer include bitmask; a layer draws into this camera only when its bit is set. The Camera component resolves its renderLayers name spec (e.g. "all !ui") down to this raw mask.
  • debugChannel — debug visualization channel.

Methods

  • scheduleRender(output, priority, fov, near, far) — schedule a single render of this camera into output (the "viewport" target or a named offscreen handle) for the current frame, at the given priority and projection.
entity(id).component.add("Camera", { fov = 60, near = 0.1, far = 1000 })
entity(id).component.Camera:scheduleRender("viewport", 0, 60, 0.1, 1000)