Camera API
Exports for scripted cameras. New to them? Read Camera System first. The play exports return false, 'busy' while another resource's camera is up; your own you may replace.
Playing
Plays one fixed camera.
| Param | Type | Description |
|---|---|---|
| opts.pos | vector3? | Position. Default: the gameplay camera's |
| opts.rot | vector3? | Rotation (pitch, roll, yaw), default 0, 0, 0 |
| opts.fov | number? | Field of view, default 60 |
| opts.filter | string? | Default 'none'; also 'scanline_cam', 'CAMERA_secuirity', 'CAMERA_secuirity_FUZZ', 'heliGunCam', 'NG_filmic04', 'NG_filmic08', 'cinema', 'underwater', 'Forest', 'Tunnel', 'phone_cam1', 'phone_cam2' |
| opts.canLook | boolean? | Mouse look, default false |
| opts.canMove | boolean? | WASD movement, default false |
| opts.exitKey | boolean? | Esc ends it, default true |
| opts.transitionIn / transitionOut | number? | Milliseconds to ease from and back to the gameplay camera, default 0 |
| opts.async | boolean? | Return at once, default false |
true, or false, 'busy', or false, why for a pos or rot that isn't a vector3exports.whip_core:PlayCamera({
pos = vector3(-1042.0, -2745.0, 22.0),
rot = vector3(-10.0, 0.0, 180.0),
fov = 50.0,
filter = 'cinema',
})
async = true. With exitKey (the default), canLook or canMove, its controls run in your thread until the camera ends.A path through points, played as a sequence: 'interpolate' is a smooth curve at one speed, 'cycle' jumps and holds.
| Param | Type | Description |
|---|---|---|
| opts.points | array | Required: at least two { pos, rot, fov?, filter? } |
| opts.mode | string? | 'interpolate' (default) or 'cycle' |
| opts.duration | number? | Whole path in ms, interpolate mode. Default 10000 |
| opts.easing | string? | Over the whole path: 'linear', 'smooth' (default), 'ease-in', 'ease-out' |
| opts.loop | boolean? | Loop the path, default false |
| opts.cycleDuration | number? | Hold per point in cycle mode, ms. Default 3000 |
| opts.transitionIn / transitionOut | number? | As PlayCamera's |
| opts.async | boolean? | Return at once, default false |
true, or false, why before any camera goes up: fewer than two points, a point without pos or rot, a duration or cycleDuration of 0, or 'busy'. A failure mid-path hands the player back to gameplayexports.whip_core:PlayCameraPath({
points = {
{ pos = vector3(100, 200, 30), rot = vector3(0, 0, 180), fov = 40 },
{ pos = vector3(105, 195, 30), rot = vector3(-10, 0, 90), fov = 50 },
},
duration = 8000,
loop = true,
async = true, -- a loop never ends: without async this never returns
})
Plays a timeline of shots, the Camera Creator's. sequence is the name it was saved under (fetched from the server the first time, so call from a thread) or the table itself, as Copy code gives it.
| Param | Type | Description |
|---|---|---|
| opts.subjects | table? | { [name] = entity | { x, y, z, h } }. 'player' and 'vehicle' (the car the player is in, or was last in) need nothing |
| opts.async | boolean? | Return at once; otherwise it waits for the end |
| opts.loop, opts.letterbox | boolean? | Override the sequence's own |
| opts.speed | number? | 1 as made, 0.5 half speed (0.05 to 20) |
| opts.startAt | number? | Milliseconds into it to start |
| opts.hold | boolean? | Stay on the last moment until stopped |
| opts.control | boolean? | The player turns and zooms its orbits (mouse and wheel, or right stick and triggers) |
| opts.exitKey | boolean? | Esc (B) ends it. Off by default |
| opts.transitionIn, opts.transitionOut | number? | Milliseconds to ease from and back to the game's camera |
true, or false, why before any camera goes up: what's wrong (the key and field), a missing subject or anchor, an unknown saved name, or 'busy'A sequence is { keys, length?, anchor?, loop?, letterbox?, ease? }, times in ms. anchor names a subject its fixed places are kept round. ease ('linear', 'smooth', 'in', 'out', 'strong') bends the whole timeline; the Camera Creator doesn't use it.
A key is { t, shot, move?, ease?, rate?, around?, coast?, shake?, filter?, punch?, label? }. move to the next key: 'cut', 'glide' (default; ease its pace, default 'smooth'), 'spring' (rate 3 gentle to 8 brisk) or 'orbit' (between two orbits of one subject; around 'short', 'left' or 'right'). coast (0.2 to 50, a resistance) makes the camera drift past a key it stops at. shake = { amount, freq }, punch = { fov, decay } (a lens kick), filter from that key on.
A shot has a kind, a fov (default 50) and, all but fixed, a subject name:
| kind | Fields |
|---|---|
| fixed | pos = { x, y, z }, rot = { x = pitch, y = roll, z = yaw } (round the anchor if there is one) |
| orbit | yaw (0 behind, 180 in front), pitch (degrees above), fit (1 fills the screen) or dist (metres), aim = { x, y, z } (the point looked at, as a share of its box, -1 to 1; +y front, +z top), look = { pitch, yaw } off that point, turn (degrees a second), clear (metres off the ground, default 0.35), roll |
| chase | dist, height, ahead (look-ahead), slip (0 follow its nose, 1 where it goes), stiff, turnRate, fovAdd and distAdd (at speed), collision (pull in at walls, default on) |
| mounted | offset = { x, y, z } in its metres (right, forward, up), rot relative to it |
| track | pos, plus an orbit's aim and look: stands still and keeps the subject in frame |
An orbit round an entity or a place { x, y, z, h }, up until StopCamera. Returns at once.
| Param | Type | Description |
|---|---|---|
| opts.yaw, pitch, fit / dist, aim, look, fov, turn, clear | number|table? | As an orbit shot's. Defaults: yaw 35, pitch 12, fit 1.3, fov 40 |
| opts.control | boolean? | The player turns and zooms it. Default on |
| opts.exitKey, opts.letterbox | boolean? | Esc (B) ends it; cinema bars |
| opts.transitionIn, opts.transitionOut | number? | Milliseconds to ease from and back to the game's camera, default 500 each |
true, or false, whyStopping and reading
Stops the camera your resource started and eases back to the normal view over its transitionOut. Another resource's camera is left alone. Not needed when your resource stops.
boolean: false when none is playing, or it's another resource'sReturns whether a scripted camera is playing.
boolean