Skip to content

Engine.camera

The camera of each local player.

Functions

Engine.camera.setZoom

Engine.camera.setZoom(zoom, localPlayerIndex)

Magnifies the camera without zooming the weapon. Look sensitivity scales down with it, like a weapon zoom.

Parameter Type Description
zoom number Magnification, greater than 0. 1 is no magnification.
localPlayerIndex integer, optional Local player whose camera is zoomed. Default is 0.

The zoom is reset when the plugin that set it unloads.

Engine.camera.getZoom

Engine.camera.getZoom(localPlayerIndex)

Returns the magnification set with setZoom, 1 when there is none. localPlayerIndex is optional, 0 by default.

Engine.camera.getCurrentCameraType

Engine.camera.getCurrentCameraType(localPlayerIndex)

Returns the type of the camera, as a string. localPlayerIndex is optional, 0 by default.

Type When
"firstPerson" First person view.
"thirdPerson" Third person view, such as in a vehicle.
"scripted" Cinematics.
"neutral" Anything else, such as when dead or with the debug camera.

Example

-- Magnify the view while in first person, like a spyglass.
Balltze.addEventListener("tick", function()
    if Engine.camera.getCurrentCameraType() == "firstPerson" then
        Engine.camera.setZoom(2)
    else
        Engine.camera.setZoom(1)
    end
end)