SetCameraFieldOfView: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Fixed template in →‎See Also)
m (Update for new version)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{client function}}
{{client function}}
{{Disabled|This function and its pair [[getCameraFieldOfView]] were disabled on r7327. See [https://github.com/multitheftauto/mtasa-blue/commit/2f892d649af212e0a998a78695c96c09e0ee03a0 the commit] for details.}}
{{New feature/item|3.0150|1.5|7285|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.}}
 
{{New items|3.0150|1.5|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.|7285}}
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool setCameraFieldOfView ( float fieldOfView )
bool setCameraFieldOfView ( string cameraMode, float fieldOfView )
</syntaxhighlight>
</syntaxhighlight>
{{OOP|This is under the static class '''Camera'''|Camera.setFieldOfView|fov|getCameraFieldOfView}}
{{OOP|This is under the static class '''Camera'''|Camera.setFieldOfView|fov|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!
*'''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.
*'''fieldOfView:''' The field of view angle, 0 to 179.
===Returns===
===Returns===
Returns ''true'' if the arguments are valid, ''false'' otherwise.
Returns ''true'' if the arguments are valid, ''false'' otherwise.

Revision as of 00:41, 7 August 2015

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.

Syntax

bool setCameraFieldOfView ( string cameraMode, float fieldOfView )

OOP Syntax Help! I don't understand this!

Note: This is under the static class Camera
Method: Camera.setFieldOfView(...)
Variable: .fov
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 is set to 20 when the player joins.

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

See Also