SET_CAM_FOV
Sets a scripted camera's field of view. The value must be a real float.
0x27666E5988D9D429SetCamFov0xB13C14F66A00D047Signature
void SET_CAM_FOV(Cam cam, float fieldOfView);Parameters
| Name | Type | Description |
|---|---|---|
cam | Cam | — |
fieldOfView | float | Vertical field of view in degrees, as a float. |
Returns void
Description
Sets the field of view of the cam.
Min: 1.0f
Max: 130.0f
Verified notes
Reviewed in this portal's repository · by borderline-rp
A whole number coming from NUI or JSON (a slider value 35, a stored 1.0 serialised as 1) arrives in Lua 5.4 as an integer. Passed here it is read as the wrong bits and ignored: no error, the FOV just does not change.
It is easy to miss: interpolated values are already floats, so a camera path with several keyframes works and one with a single keyframe does not.
SetCamFov(cam, (tonumber(data.fov) or 50) + 0.0)This applies to every float parameter of every native. Integers that really are integers (handles, hashes, hours) must not be converted.
Verified in game on the Borderline RP server, September 2026.
Usage
SetCamFov(cam, fieldOfView)
-- always works, by hash
Citizen.InvokeNative(0x27666E5988D9D429, cam, fieldOfView)JavaScript and C#
SetCamFov(cam, fieldOfView);
// by hash
Citizen.invokeNative('0x27666E5988D9D429', cam, fieldOfView + 0.0000001);Function.Call((Hash)0x27666E5988D9D429, cam, fieldOfView);- Float parameters: Lua integers (
10, or whole numbers decoded from NUI/JSON) are sent as ints and read as garbage. Write10.0orvalue + 0.0. The generated JS wrappers add0.0000001to non-zero floats for the same reason.
See also
Sources
alloc8or RDR3 NativeDB · RedM Natives (verified notes)
Something wrong or missing? Contribute a verified note — corrections ship through pull requests.