cams
The car camera family as functions. `modes()` lists the eight modes; `set(camera, mode, car?)` switches a camera (through its DriveCam when it has one, so it sticks); `cycle(camera, dir?)` steps to the next; `apply` puts a mode's behaviour, tuning and FOV on a camera now; `tune`…
driveCams.cams
The car camera family as functions. modes() lists the eight modes;
set(camera, mode, car?) switches a camera (through its DriveCam when it has
one, so it sticks); cycle(camera, dir?) steps to the next; apply puts a
mode's behaviour, tuning and FOV on a camera now; tune re-tunes the running
rig; mounts(car) answers the cockpit / hood / bumper / rear points in
chassis-local metres (from the car's car.mountSeat / car.mountHood /
car.mountBumper values, else from car.size, its BoxCollider or bounds);
speedOf(car), carOf(id), behaviorOf(mode) and mainCamera() are
exported too. Used by DriveCam; call it from game code to switch views.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2driveCams.cams — a family of car cameras, switched by one word. local Cams = require("driveCams.cams") Cams.modes() --> { "chase", "cockpit", "hood", "bumper", "orbit", "tv", "heli", "rear" } Cams.set(cameraEntity, "cockpit", car) -- car optional: empty keeps what the camera follows Cams.cycle(cameraEntity) --> the next mode Cams.mounts(car) --> { seat, hood, bumper, rear, half } in chassis-local metres Each mode is a builtin camera behaviour tuned for a car, or one of this package's own: chase = @builtin::controller.chase (speed-sensitive FOV when a DriveCam drives it), cockpit / hood / bumper / rear = @builtin::controller.mount at the car's mount points, orbit = @builtin::controller.orbital_follow, tv = driveCams.TvCam (trackside cameras that cut and zoom), heli = driveCams.HeliCam. Mount points come from the car's own values `car.mountSeat`, `car.mountHood`, `car.mountBumper` (vectors, chassis-local, forward -Z), and fall back to points worked out from `car.size`, the car's BoxCollider or its bounds.
modes( ) → void
Every mode, in cycle order.
has(mode: string) → boolean
| arg | type | description |
|---|---|---|
| mode | string |
behaviorOf(mode: string) → string
The behaviour component (asset identity) a mode runs.
| arg | type | description |
|---|---|---|
| mode | string |
idOf(v: any) → string
| arg | type | description |
|---|---|---|
| v | any |
exists(id: string?) → boolean
| arg | type | description |
|---|---|---|
| id | string? |
vec(v: any) → vector
| arg | type | description |
|---|---|---|
| v | any |
value(id: string, name: string) → any
| arg | type | description |
|---|---|---|
| id | string | |
| name | string |
carOf(id: string?) → string
The car an entity belongs to: itself when it writes car values or drives with a VehicleController, else its nearest such ancestor, else the entity itself.
| arg | type | description |
|---|---|---|
| id | string? |
halfExtents(carId: string) → vector
Half extents of the car's body (x right, y up, z length) in chassis-local metres.
| arg | type | description |
|---|---|---|
| carId | string |
mounts(car: any) → any
Camera mount points in chassis-local metres (x right, y up, z back): `seat` (driver's eye), `hood`, `bumper`, `rear` (looking back from the tail), plus `half` (half extents) and `source` ("values" when the car states them).
| arg | type | description |
|---|---|---|
| car | any |
speedOf(car: any) → number
The car's forward speed in m/s (car.speed, else Physics.vehicleState, else 0).
| arg | type | description |
|---|---|---|
| car | any |
rigOf(camEnt: any, mode: string) → any
| arg | type | description |
|---|---|---|
| camEnt | any | |
| mode | string |
tune(camEnt: any, mode: string, carId: string?) → boolean
Tune the running rig on `camEnt` for `mode` and car `carId`. Answers true once the rig was found.
| arg | type | description |
|---|---|---|
| camEnt | any | |
| mode | string | |
| carId | string? |
cameraOf(camEnt: any) → any
| arg | type | description |
|---|---|---|
| camEnt | any |
behaviorRef(mode: string) → any
Literal references, so every behaviour is pinned when the package publishes.
| arg | type | description |
|---|---|---|
| mode | string |
apply(cameraEntity: any, mode: string, car: any?) → boolean
Put `mode` on the camera entity now (behaviour + tuning + FOV), following `car` when given. Answers true when the camera took it. A DriveCam on the camera keeps it in that mode; without one this is a one-off switch.
| arg | type | description |
|---|---|---|
| cameraEntity | any | |
| mode | string | |
| car | any? |
driveCamOf(camEnt: any) → any
| arg | type | description |
|---|---|---|
| camEnt | any |
set(cameraEntity: any, mode: string, car: any?) → boolean
Switch a camera to `mode` (one word), following `car` when given (else what it already follows). With a DriveCam on the camera the setting is written there (and persists); otherwise applied directly.
| arg | type | description |
|---|---|---|
| cameraEntity | any | |
| mode | string | |
| car | any? |
cycle(cameraEntity: any, dir: number?) → string
Step a camera to its next mode (dir -1 goes back). Answers the new mode.
| arg | type | description |
|---|---|---|
| cameraEntity | any | |
| dir | number? |
mainCamera( ) → string
The main (player) camera entity id, or nil.
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.