Skip to main content
reskate.camera takes the game’s camera and shows the view your plugin chooses, follows a session player with Spectate’s camera, turns on the game’s free camera, and reads the camera as it is now. Every function needs the camera permission; calling one without it raises an error. See permissions.

How the camera is shared

  • One plugin holds the camera at a time. The first look or set takes it; another plugin’s look, set or follow is refused with "<plugin> has the camera" until the holder releases it.
  • The view you give is held until you give another. To move the camera, call look or set again, usually every tick.
  • Spectate takes the camera back while it runs, whether the player started it or a plugin did with follow. Your plugin still holds the camera meanwhile, but its view is not shown: held() says "Spectate has the camera". When Spectate ends, your view is shown again.
  • release() gives the game its own camera back. When the plugin stops (unloaded, reloaded, or stopped for going over a limit), its camera is released the same way, and a Spectate it started with follow ends.
Your view also decides what input the plugin may read: input.flight and input.capture work only while the plugin’s own view is shown.

reskate.camera.look(position, target, fov)

Shows the view from position towards target, upright (no roll). Use it for a camera that watches something.
vector
required
Where the camera is. Finite, within 100 km.
vector
required
What it looks at. Finite, within 100 km, and not the same point as position.
number
default:"the camera's own"
The vertical field of view: 10 to 150 degrees. 0 or nothing keeps the camera’s own.
boolean
True when the plugin holds the camera with this view.
string
Why not: "<plugin> has the camera" or "<plugin> is following a player with it".
A position that is not finite, the same point twice, or a field of view out of range raises an error.
Needs the camera permission. It has no rate limit: call it every tick.

reskate.camera.set(position, forward, up, fov)

Shows the view from position along forward, with up giving the camera’s roll. Use it for a camera that flies, banks or turns over.
vector
required
Where the camera is. Finite, within 100 km.
vector
required
The way it looks. Any length but 0.
vector
required
Which way is up on screen. It need not be at right angles to forward, but it cannot be along it.
number
default:"the camera's own"
The vertical field of view: 10 to 150 degrees. 0 or nothing keeps the camera’s own.
boolean
True when the plugin holds the camera with this view.
string
Why not: "<plugin> has the camera" or "<plugin> is following a player with it".
A heading is in radians about world up, 0 facing +Z. Facing +Z, the view’s right is -X, so for a heading h the right is vector.create(-math.cos(h), 0, math.sin(h)).
A forward of no length, an up along forward, or a field of view out of range raises an error.
Needs the camera permission. It has no rate limit: call it every tick.

reskate.camera.follow(player)

Starts Spectate’s camera on a session player, or stops the Spectate this plugin started. If the plugin held the camera with a view of its own, that view is released first.
string or table
A player’s id ("7656...") or a player table with an id, such as one from reskate.session.players(). nil or nothing stops following.
boolean
True when Spectate was asked to follow the player (or to stop).
string
Why not: "<plugin> has the camera", "not in a session" or "asked more than 4 times in a second".
A player that is not an id raises an error.
Needs the camera permission. Shares the budget of 4 control calls a second with skater.noclip, boost, freeze, ai.spawn, animation.play, board.toss and outfit.set.

reskate.camera.release()

Gives the game its own camera back, and stops a Spectate this plugin started. Releasing a camera the plugin does not hold does nothing. Returns nothing.
Needs the camera permission. The camera is released when the plugin stops whether or not it calls this.

reskate.camera.held()

Whether the plugin’s view (or its Spectate) is the one shown now. After look or set, the view takes a moment to be shown.
boolean
True while the plugin’s view is shown, or while the Spectate it started is running.
string
Why not: "it does not hold the camera", "waiting for the game's camera", "Spectate has the camera", "Spectate is starting", or the game’s reason it cannot show the view now.
Needs the camera permission.

reskate.camera.get()

The camera as it is now: the game’s own, Spectate’s, or a plugin’s view.
table or nil
nil when there is no camera to read.
Needs the camera permission.

The camera height cycle

The game’s camera height button (the right stick click) steps between its high and low cameras, and ReSkate’s first person when that is in the cycle. Your plugin’s camera can be a step of it too, last: high, low, first person, your camera, and back to high. The step into your camera keeps the low camera behind it, and the step out of it always lands on the high camera.

reskate.camera.cycle(state)

Puts your camera in the cycle, or takes it out.
string or nil
required
"ready": in the cycle, off (the next press past the low camera starts it). "active": in the cycle and on (the next press stops it). nil: out of the cycle.
boolean
True when your camera is in the cycle (or out of it).
string
"<plugin> is in the camera cycle" when another plugin’s camera was in it in the last 300 ms.
The press asks your plugin to start or stop its camera with the camera_cycle event; see events. Your plugin does the starting and stopping, as it does when the player uses its own command or bind.
Needs the camera permission. Your place in the cycle lasts 300 ms: say it every tick. One plugin’s camera is in the cycle at a time. When the plugin stops, its camera leaves the cycle.

The free camera

The game’s free camera is ReSkate’s Freecam: the player flies it with the flight keys and the mouse, or with the pad. A plugin turns it on for something the player does from the air, such as placing things. It is not a view of your plugin’s own: look, set and held do not take part.

reskate.camera.free(on)

Turns the free camera on or off, as ReSkate’s own Freecam does.
boolean
required
True to turn it on, false (or nothing) to turn it off.
boolean
True when the change was asked for. It takes a moment: get().free says when the free camera is shown.
string
"unavailable here" on a server copy.
Needs the camera permission. The plugin that last turned the free camera on owns it: another plugin’s free(false) does nothing (and returns true). When the plugin stops, a free camera it owns is turned off.

reskate.camera.pad_flight(on)

Lets the player fly the free camera from the pad: the controller flies it, the bumpers (or Q and E) move it up and down, and the triggers are left for your plugin. It flies only while the free camera is on. Meanwhile the game does not read the controller, and ReSkate’s own controller binds do not fire.
boolean
required
True to fly from the pad, false (or nothing) to stop.
boolean
True when the plugin flies the camera from the pad (or has stopped).
string
Why not: "<plugin> flies the camera from the pad" (another plugin has it), or "unavailable here" on a server copy.
Needs the camera permission. One plugin flies from the pad at a time, until it stops: another plugin’s pad_flight(false) does nothing. When the plugin stops, its pad flight ends.
For a camera the player flies with the keyboard, mouse or a gamepad, see input and the flying camera guide.