cams
The crashCams API (`require("crashCams.cams")`): `Cams.kinds()`, `Cams.use(camera, kind, targets, fields?)` to switch a Camera to one of the six crash-test camera behaviours, `Cams.setTargets`, `Cams.current`, `Cams.director(camera, { shots, cut, targets, clock, overlay, onCut })…
cams
The crashCams API (require("crashCams.cams")): Cams.kinds(), Cams.use(camera, kind, targets, fields?) to switch a Camera to one of the six crash-test camera behaviours, Cams.setTargets, Cams.current, Cams.director(camera, { shots, cut, targets, clock, overlay, onCut }) returning a director with :start(), :stop(), :next(), :current(), :cutTo(), Cams.overlay for the REC / timecode burn-in, Cams.impactShake (juiceKit when installed), and Cams.dressing(position, "tripod" | "boom" | "pit", opts) to spawn physical camera props. Called by game code, test rigs and scene builds; the package README documents every call.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2crashCams.cams — the crash-test cameras, the replay director and the camera props. local Cams = require("crashCams.cams") Cams.use(cameraEntity, "highSpeedSide", { car = chassisId, head = headId, impact = { 0, 0.5, 0 } }) local dir = Cams.director(cameraEntity, { shots = { "highSpeedSide", "barrierFace" }, cut = 1.6 }) dir:start() Every camera is a camera behaviour (a component `Camera.behavior` names), so switching shot is one write on the camera you already have. Cameras are per player: each peer drives its own view and nothing here syncs.
kindOf(kind: string) → Kind
| arg | type | description |
|---|---|---|
| kind | string |
camEntity(cam: any) → any
An entity proxy out of an id, a name or a proxy.
| arg | type | description |
|---|---|---|
| cam | any |
idOf(v: any) → string
| arg | type | description |
|---|---|---|
| v | any |
vec(v: any) → void
| arg | type | description |
|---|---|---|
| v | any |
kinds( ) →
Every camera kind: `{ id, name, description }` rows in catalog order.
component(kind: string) → any
The behaviour component a kind is, as the reference `Camera.behavior` takes.
| arg | type | description |
|---|---|---|
| kind | string |
writeTargets(e: any, kind: Kind, targets: Targets?, fields: { [string]: any }?) → void
Write the targets onto the behaviour attached for `kind`.
| arg | type | description |
|---|---|---|
| e | any | |
| kind | Kind | |
| targets | Targets? | |
| fields | { [string]: any }? |
use(cameraEntity: any, kind: string, targets: Targets?, fields: { [string]: any }?) → any
Point a camera at the crash with one of the six test cameras: swaps the Camera's behaviour to that kind and sets its targets. `fields` optionally tunes the behaviour (`{ side = -1 }`, `{ fov = 30 }`).
| arg | type | description |
|---|---|---|
| cameraEntity | any | The entity carrying a `Camera` (proxy, id or name). |
| kind | string | One of `Cams.kinds()` ids. |
| targets | Targets? | `{ car = chassisId, head = headId, impact = {x,y,z} }`; missing keys keep what the camera had. |
| fields | { [string]: any }? |
examples
Cams.use(cam, "barrierFace", { car = car.id, head = d.head, impact = { 0, 0.5, 0 } })setTargets(cameraEntity: any, targets: Targets) → void
Change what a camera frames without changing its shot.
| arg | type | description |
|---|---|---|
| cameraEntity | any | |
| targets | Targets |
current(cameraEntity: any) → string
The kind a camera is showing, or nil.
| arg | type | description |
|---|---|---|
| cameraEntity | any |
overlay(cameraEntity: any, on: boolean?, opts: { [string]: any }?) → any
Show or hide the recording burn-in (REC dot, label, fps, timecode, frame counter) on a camera. Local UI on this peer only.
| arg | type | description |
|---|---|---|
| cameraEntity | any | |
| on | boolean? | |
| opts | { [string]: any }? | `{ label?, fps?, shutter?, showFrame?, tint? }` |
impactShake(intensity: number?) → boolean
Kick the camera on screen with an impact shake, through the Juicebox juiceKit when the world has it installed. Local to this peer.
| arg | type | description |
|---|---|---|
| intensity | number? | 0..2, default 1. |
shotOf(v: any, cut: number) → Shot
| arg | type | description |
|---|---|---|
| v | any | |
| cut | number |
director(cameraEntity: any, opts: { [string]: any }?) → any
A director that cuts one camera between shots on a timer: the replay of a crash from two or more angles. { kind, hold?, targets?, fields?, label? }), cut = seconds per shot (1.6), targets = { car, head, impact }, loop = true, clock = "real" | "sim" ("real" cuts on the wall clock so a slow-motion replay still cuts at the same pace; "sim" cuts on the simulation clock), overlay = false, onCut = function(kind, index) }`
| arg | type | description |
|---|---|---|
| cameraEntity | any | The entity carrying the `Camera` it drives. |
| opts | { [string]: any }? | `{ shots = { "highSpeedSide", "barrierFace", ... } (kind ids or |
cutTo(index: number) → void
Cut to shot `index` now (1-based) and restart its hold.
| arg | type | description |
|---|---|---|
| index | number |
next( ) → void
Cut to the next shot (wraps when `loop`; at the end of a non-looping list it stops).
current( ) → void
The kind on screen and its index, or nil before the first cut.
setTargets(targets: Targets) → void
Change what every shot frames from now on (the current shot included).
| arg | type | description |
|---|---|---|
| targets | Targets |
start(index: number?) → void
Start cutting: cuts to shot `index` (default 1) at once and to the next one every `hold` seconds. The cutting belongs to whatever called `start` (a component's hook: it ends with that component).
| arg | type | description |
|---|---|---|
| index | number? |
stop( ) → void
Stop cutting; the camera holds the shot it is on.
quatAxisAngle(ax: number, ay: number, az: number, angle: number) → void
| arg | type | description |
|---|---|---|
| ax | number | |
| ay | number | |
| az | number | |
| angle | number |
alongY(dx: number, dy: number, dz: number) → void
A rotation turning +Y onto the direction (dx, dy, dz): for a cylinder (whose length runs along Y).
| arg | type | description |
|---|---|---|
| dx | number | |
| dy | number | |
| dz | number |
group(b: Builder, parent: any, name: string, pos: { number }, rot: { number }?) → any
| arg | type | description |
|---|---|---|
| b | Builder | |
| parent | any | |
| name | string | |
| pos | { number } | |
| rot | { number }? |
rod(b: Builder, parent: any, name: string, mat: any, a: { number }, c: { number }, radius: number) → any
A cylinder between two points (in the parent's frame).
| arg | type | description |
|---|---|---|
| b | Builder | |
| parent | any | |
| name | string | |
| mat | any | |
| a | { number } | |
| c | { number } | |
| radius | number |
cameraHead(b: Builder, parent: any, tilt: number) → any
The camera itself: a high-speed lab camera body with its lens along -Z, built around its own origin (the tripod screw under the body).
| arg | type | description |
|---|---|---|
| b | Builder | |
| parent | any | |
| tilt | number |
tripod(b: Builder, root: any, height: number, tilt: number) → void
| arg | type | description |
|---|---|---|
| b | Builder | |
| root | any | |
| height | number | |
| tilt | number |
boom(b: Builder, root: any, height: number, reach: number) → void
| arg | type | description |
|---|---|---|
| b | Builder | |
| root | any | |
| height | number | |
| reach | number |
pit(b: Builder, root: any, width: number, length: number, depth: number, withGlass: boolean) → void
| arg | type | description |
|---|---|---|
| b | Builder | |
| root | any | |
| width | number | |
| length | number | |
| depth | number | |
| withGlass | boolean |
dressing(position: any, kind: string?, opts: { [string]: any }?) → any
Spawn a physical camera prop so the lab looks real. overhead camera hung from a counterweighted boom), or `"pit"` (a glass-floor camera pit sunk below `position`, with floods and its camera). height = metres (tripod lens height 1.35; boom mast 4.5), reach = boom arm metres (2.5), width / length / depth = pit size (1.6 x 2.6 x 1.1), glass = true (pit pane with a collider), collider = false (a static box around a tripod or boom), synced = false (spawn with entity.spawnSynced from one peer; otherwise call it on every peer or from a scene build), name = "CrashCamProp", parent = entity }`
| arg | type | description |
|---|---|---|
| position | any | Ground point the prop stands on (`{x,y,z}`). |
| kind | string? | `"tripod"` (a high-speed camera on a tripod, default), `"boom"` (an |
| opts | { [string]: any }? | `{ aimAt = {x,y,z} (turns the prop to face it), yaw = degrees, |
dressingKinds( ) → void
The prop kinds `Cams.dressing` builds.
Targets = { car: any?, head: any?, impact: any? }Kind = { id: string, name: string, description: string, component: string }Shot = { kind: string, hold: number?, targets: Targets?, fields: { [string]: any }?, label: string? }Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.