camera
The local view: third-person state, the position the frame is rendered from, and reading or writing the view angles.
The local view. Every Lua call runs on the game thread, the thread these read and write on, so there is no other thread to call them from.
| Function | Returns | Description |
|---|---|---|
camera.is_thirdperson() | boolean | Whether the game's camera is in third person (the input's third-person flag). false while the input system is not up. |
camera.position() | vector or nil | Where the frame is rendered from: the origin of the view the game set up this frame, read right after it was set up and before any override_view callback changes it. Third person, a spectated player's eyes and a free camera are all included. nil while not in game. |
camera.angles() | angle or nil | The view angles the game's input holds: what the next command is built from and the view is set up with (with recoil and view punch not applied). nil while the input system is not up. They exist without a local player, so this also works in the menu. |
camera.angles(new) | boolean | Writes new (an angle) into the input's view angles through the game's own setter, as moving the mouse does: the view turns, and the next command carries it once a local player exists. true once written, false while the input system is not up. A non-finite component raises angles must be finite and writes nothing. |
The argument of camera.angles is an angle, not a boolean: called with nothing (or nil) it reads, called with an angle it writes.
