Camera::isActive: Difference between revisions

From RAGE Multiplayer Wiki
 
Line 6: Line 6:
*'''Boolean'''
*'''Boolean'''
==Example==
==Example==
This example create a camera and then checks if the camera is active, if it's not active it should active it.
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
let camera = mp.cameras.new('default', new mp.Vector3(-485, 1095.75, 323.85), new mp.Vector3(0,0,0), 40); // Creates the camera
let camera = mp.cameras.new('default', new mp.Vector3(-485, 1095.75, 323.85), new mp.Vector3(0,0,0), 40); // Creates the camera


if (camera.isActive()) {
if (camera.isActive()) { // checks if camera is active, if not then it should set the camera active
   camera.setFov(15);
   camera.setFov(15);
} else {
} else {

Latest revision as of 23:34, 11 December 2020

Returns whether or not the passed camera handle is active.

Syntax

camera.isActive();

Required Arguments

Return value

  • Boolean

Example

This example create a camera and then checks if the camera is active, if it's not active it should active it.

let camera = mp.cameras.new('default', new mp.Vector3(-485, 1095.75, 323.85), new mp.Vector3(0,0,0), 40); // Creates the camera

if (camera.isActive()) { // checks if camera is active, if not then it should set the camera active
  camera.setFov(15);
} else {
  camera.setActive(true);
}

See also