Skip to content

accessCarCamera

Provides access to the configuration of a car’s external cameras, which are typically cycled using the F6 F6 key. It returns an ac.CarCameraParams object used to read or modify properties such as position, direction, and field of view.

Access the first available external camera for the targeted car.

local camera = ac.accessCarCamera(0)

The ac.accessCarCamera function allows scripts to dynamically alter the behavior of car-mounted cameras. This is frequently used for creating cinematic tools, custom replay angles, or adjusting the default “chase” views provided by the car’s developer.

The returned object allows scripts to modify the camera’s position and orientation relative to the car, adjust its field of view for cinematic effects, and fine-tune rendering parameters such as exposure and depth of field.

ParameterTypeRequiredDescription
cameraIndexintegerYesThe 0-based index of the car camera to access.
TypeDescription
ac.CarCameraParamsAn object providing access to camera properties. Returns nil if the index is invalid.

Retrieving the first camera and setting a wide-angle field of view.

local cam = ac.accessCarCamera(0)
if cam then
-- set to a very wide 110-degree FOV
cam.fov = 110
end