Builtin Library
README.md
camera
Author and manage the cameras in a scene: create one, list every camera, read its full parameters, change them, aim it, frame a subject, or make it the primary camera. A physical camera on the machine (a webcam, a phone camera) is cameraInput, covered by the topics/camera-input guide.
Create & inspect
- create — spawn a camera entity at a position, with any starting parameters in one call: fov, near/far, priority, render layers, a follow target, a behavior, a
lookAt, andtarget(render-to-texture —trueor{ width, height, name }renders the camera offscreen instead of to the viewport). Returns the new camera's full parameter record. - list — every camera in the scene, enumerated from the live ECS so a just-spawned, hidden, or runtime camera is never missed, sorted by descending priority, each row marking whether it is the on-screen (
active) camera, whether it is theplayercamera (the one the PlayerPrototype uses), and its main/editor role. - get — the full parameter record for one camera (position, rotation, fov, near, far, priority, render layers, debug channel, render target, behavior, follow). Defaults to the active/main camera when you name none.
Modify
- set — change any of these camera parameters in one call:
fov,near,far,priority,debugPass(the diagnostic view this camera renders, by name),debugChannel(the same as a raw numeric channel),renderLayers(the layer-name spec, e.g."all !ui"),behavior(acameraBehavior-tagged component), andfollow(the entity the behavior tracks). Pass no camera to modify the active one. A camera's render target is set when it is created (createwithopts.target). - lookAt — aim a camera at a world position or at another entity.
- frame — position and aim a camera to frame a target entity from a distance and angle in one step.
- bindToPlayer — make the joining player use a camera in play by binding it to the scene's PlayerPrototype: it re-parents the camera into the prototype (so it is cloned with the player) and sets the prototype's
camerarole to it. Pair it with a static behavior (set { behavior = "@builtin::controller.menu" }) for a fixed PS1-style camera the player moves within, or a follow behavior (orbital_follow,third_person_follow,first_person, …) for a tracking one. A player-less scene has no prototype — there the rendering camera is simply the highest-priority one, ordered withset { priority = N }.
Related surfaces
- Capturing an image from a specific camera is the
capturetoolbox (capturewith a camera, oroneshot) — it renders any camera's authored pose offscreen without changing what is on screen. - Putting geometry ON a render layer is the
renderLayertoolbox (renderLayer.set);renderLayer.camerais the layer-system-side way to set a camera's include filter, the same fieldcamera.set { renderLayers = ... }writes. - The scene's primary camera is normally spawned for you from the scene's PlayerPrototype;
camera.createadds additional cameras (a security view, a cutscene angle, a render-texture feed).