SetCameraFieldOfView: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(3 intermediate revisions by 3 users not shown)
Line 8: Line 8:
bool setCameraFieldOfView ( string cameraMode, float fieldOfView )
bool setCameraFieldOfView ( string cameraMode, float fieldOfView )
</syntaxhighlight>
</syntaxhighlight>
{{OOP|This is under the static class '''Camera'''|Camera.setFieldOfView||getCameraFieldOfView}}
{{OOP||Camera.setFieldOfView||getCameraFieldOfView}}
===Required Arguments===  
===Required Arguments===  
'''Note:''' after 100, some unexpected things may happen to the camera, particularly in vehicles, use carefully!
'''Note:''' after 100, some unexpected things may happen to the camera, particularly in vehicles, use carefully!
Line 20: Line 20:


==Example==
==Example==
In this example, the field of view is set to 20 when the player joins.
In this example, the field of view for 'player walking/running' is set to 20 when the player joins.


<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function setCameraFOVOnResStart()
function setCameraFOVOnResStart()
     setCameraFieldOfView(20)
     setCameraFieldOfView("player",20)
end
end
addEventHandler("onClientResourceStart", resourceRoot, setCameraFOVOnResStart)</syntaxhighlight>
addEventHandler("onClientResourceStart", resourceRoot, setCameraFOVOnResStart)</syntaxhighlight>
Line 30: Line 30:
==See Also==
==See Also==
{{Client camera functions}}
{{Client camera functions}}
[[hu:setCameraFieldOfView]]
[[RO:setCameraFieldOfView]]

Latest revision as of 09:23, 10 October 2020

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.

[[{{{image}}}|link=|]] Note: setCameraFieldOfView overrides the user game option in Settings->Video->FOV
[[{{{image}}}|link=|]] Note: setCameraFieldOfView does not affect the FOV for the following camera modes: 1) Player aiming 2) Vehicle front bumper camera 3) Fixed camera

Syntax

bool setCameraFieldOfView ( string cameraMode, float fieldOfView )

OOP Syntax Help! I don't understand this!

Method: Camera.setFieldOfView(...)
Counterpart: getCameraFieldOfView


Required Arguments

Note: after 100, some unexpected things may happen to the camera, particularly in vehicles, use carefully!

  • cameraMode: the camera mode to get 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.

Returns

Returns true if the arguments are valid, false otherwise.

Example

In this example, the field of view for 'player walking/running' is set to 20 when the player joins.

function setCameraFOVOnResStart()
    setCameraFieldOfView("player",20)
end
addEventHandler("onClientResourceStart", resourceRoot, setCameraFOVOnResStart)

See Also