Esc to clear, Enter to open the best match, click an export to open it in its page
Interactions & UI

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

PlayCamera(opts)CLIENT#

Plays one fixed camera.

ParamTypeDescription
opts.posvector3?Position. Default: the gameplay camera's
opts.rotvector3?Rotation (pitch, roll, yaw), default 0, 0, 0
opts.fovnumber?Field of view, default 60
opts.filterstring?Default 'none'; also 'scanline_cam', 'CAMERA_secuirity', 'CAMERA_secuirity_FUZZ', 'heliGunCam', 'NG_filmic04', 'NG_filmic08', 'cinema', 'underwater', 'Forest', 'Tunnel', 'phone_cam1', 'phone_cam2'
opts.canLookboolean?Mouse look, default false
opts.canMoveboolean?WASD movement, default false
opts.exitKeyboolean?Esc ends it, default true
opts.transitionIn / transitionOutnumber?Milliseconds to ease from and back to the gameplay camera, default 0
opts.asyncboolean?Return at once, default false
Returns: true, or false, 'busy', or false, why for a pos or rot that isn't a vector3
exports.whip_core:PlayCamera({
    pos    = vector3(-1042.0, -2745.0, 22.0),
    rot    = vector3(-10.0, 0.0, 180.0),
    fov    = 50.0,
    filter = 'cinema',
})
It waits unless async = true. With exitKey (the default), canLook or canMove, its controls run in your thread until the camera ends.
PlayCameraPath(opts)CLIENTWAITS#

A path through points, played as a sequence: 'interpolate' is a smooth curve at one speed, 'cycle' jumps and holds.

ParamTypeDescription
opts.pointsarrayRequired: at least two { pos, rot, fov?, filter? }
opts.modestring?'interpolate' (default) or 'cycle'
opts.durationnumber?Whole path in ms, interpolate mode. Default 10000
opts.easingstring?Over the whole path: 'linear', 'smooth' (default), 'ease-in', 'ease-out'
opts.loopboolean?Loop the path, default false
opts.cycleDurationnumber?Hold per point in cycle mode, ms. Default 3000
opts.transitionIn / transitionOutnumber?As PlayCamera's
opts.asyncboolean?Return at once, default false
Returns: 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 gameplay
exports.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
})
PlayCameraSequence(sequence, opts?)CLIENTWAITS#

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.

ParamTypeDescription
opts.subjectstable?{ [name] = entity | { x, y, z, h } }. 'player' and 'vehicle' (the car the player is in, or was last in) need nothing
opts.asyncboolean?Return at once; otherwise it waits for the end
opts.loop, opts.letterboxboolean?Override the sequence's own
opts.speednumber?1 as made, 0.5 half speed (0.05 to 20)
opts.startAtnumber?Milliseconds into it to start
opts.holdboolean?Stay on the last moment until stopped
opts.controlboolean?The player turns and zooms its orbits (mouse and wheel, or right stick and triggers)
opts.exitKeyboolean?Esc (B) ends it. Off by default
opts.transitionIn, opts.transitionOutnumber?Milliseconds to ease from and back to the game's camera
Returns: 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:

kindFields
fixedpos = { x, y, z }, rot = { x = pitch, y = roll, z = yaw } (round the anchor if there is one)
orbityaw (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
chasedist, 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)
mountedoffset = { x, y, z } in its metres (right, forward, up), rot relative to it
trackpos, plus an orbit's aim and look: stands still and keeps the subject in frame
OrbitCamera(target, opts?)CLIENTWAITS#

An orbit round an entity or a place { x, y, z, h }, up until StopCamera. Returns at once.

ParamTypeDescription
opts.yaw, pitch, fit / dist, aim, look, fov, turn, clearnumber|table?As an orbit shot's. Defaults: yaw 35, pitch 12, fit 1.3, fov 40
opts.controlboolean?The player turns and zooms it. Default on
opts.exitKey, opts.letterboxboolean?Esc (B) ends it; cinema bars
opts.transitionIn, opts.transitionOutnumber?Milliseconds to ease from and back to the game's camera, default 500 each
Returns: true, or false, why

Stopping and reading

StopCamera()CLIENT#

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.

Returns: boolean: false when none is playing, or it's another resource's
IsCameraActive()CLIENT#

Returns whether a scripted camera is playing.

Returns: boolean