setCameraFieldOfView
Client-side
Server-side
Shared
Pair: getCameraFieldOfView
Updated in 1.6.0 r23300
This function sets the field of view of the dynamic camera - this is the field of view of the non-fixed camera - yes, the camera that the user can control whilst on foot or in a vehicle. The higher the field of view angle, the more you will be able to see to your sides.
Note
- This function omits (but doesn't override) the user game option in Settings -> Video -> FOV.
- It doesn't affect the FOV for the following camera modes: player aiming, vehicle front bumper camera, fixed camera.
Caution
When fov is > 100, some unexpected things may happen to the camera, particularly in vehicles, use carefully!
OOP Syntax Help! I don't understand this!
- Method:Camera.setFieldOfView(...)
Syntax
bool setCameraFieldOfView ( string cameraMode, float fieldOfView, [ bool instant = false ] )Required Arguments
- cameraMode: The camera mode to set the field of view of.
- player: whilst walking/running
- vehicle: whilst in vehicle
- vehicle_max: the max the field of view can go to when the vehicle is moving at a high speed (must be higher than "vehicle")
- fieldOfView: The field of view angle, 0 to 179.
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.
- instant (default: false): If set to true, the value is applied immediately, without delay (does not work with "vehicle_max").
Returns
- bool: result
Returns true if the arguments are valid, false otherwise.
Code Examples
client
In this example, the field of view for 'player walking/running' camera is set to 20, once resource fully starts.
local function changeCameraFovOnClientResourceStart() setCameraFieldOfView("player", 20)endaddEventHandler("onClientResourceStart", resourceRoot, changeCameraFovOnClientResourceStart)Changelog
Added instant argument.
See Also
Camera Functions
- fadeCamera
- getCamera
- getCameraClip
- getCameraDrunkLevel
- getCameraFieldOfView
- getCameraGoggleEffect
- getCameraInterior
- getCameraMatrix
- getCameraTarget
- getCameraViewMode
- resetShakeCamera
- setCameraClip
- setCameraDrunkLevel
- setCameraFieldOfView
- setCameraGoggleEffect
- setCameraInterior
- setCameraMatrix
- setCameraTarget
- setCameraViewMode
- shakeCamera