Camera::setFarClip: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{JSContainer|
This function sets the far clip distance for a camera in the game. The far clip distance determines how far the camera can render objects; increasing this value allows the camera to display objects at greater distances. This is especially useful for enhancing visibility in larger scenes.


==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">camera.setFarClip(farClip);</syntaxhighlight>
<syntaxhighlight lang="javascript">camera.setFarClip(farClip);</syntaxhighlight>
=== Required Arguments ===
=== Required Arguments ===
*'''farClip:''' float
*'''farClip:''' float
===Return value===
===Return value===
*'''Undefined'''
*'''Undefined'''
==Example==
==Example==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
// Create a camera at a specific position and rotation
let camera = mp.cameras.new("default", new mp.Vector3(0, 0, 0), new mp.Vector3(0, 0, 0), 70);
 
// Set the far clip distance for the camera
const farClipDistance = 1000.0; // Example distance in units
camera.setFarClip(farClipDistance);
 
// Render the camera
camera.setActive(true);
mp.game.cam.renderScriptCams(true, false, 0, true, false);
</syntaxhighlight>
</syntaxhighlight>
}}
==See also==
==See also==
{{Camera_function_c}}
{{Camera_definition_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Latest revision as of 11:39, 2 November 2024

JavaScript Syntax


This function sets the far clip distance for a camera in the game. The far clip distance determines how far the camera can render objects; increasing this value allows the camera to display objects at greater distances. This is especially useful for enhancing visibility in larger scenes.

Syntax

camera.setFarClip(farClip);

Required Arguments

  • farClip: float

Return value

  • Undefined

Example

// Create a camera at a specific position and rotation
let camera = mp.cameras.new("default", new mp.Vector3(0, 0, 0), new mp.Vector3(0, 0, 0), 70);

// Set the far clip distance for the camera
const farClipDistance = 1000.0; // Example distance in units
camera.setFarClip(farClipDistance);

// Render the camera
camera.setActive(true);
mp.game.cam.renderScriptCams(true, false, 0, true, false);


See also