Camera::Camera: Difference between revisions

From RAGE Multiplayer Wiki
(Undo revision 20521 by KirillZver (talk))
Tag: Undo
 
(5 intermediate revisions by 5 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
'''Function''': Creates a camera.
Creates a camera.
 
==Syntax==
<pre>
mp.cameras.new(name, position, rotation, fov);
</pre>


==Parameters==
==Parameters==
Line 8: Line 13:
*'''fov''': {{RageType|Int}}
*'''fov''': {{RageType|Int}}


==Syntax==
==Examples==
<syntaxhighlight lang="javascript">
Creates a camera and sets it to look towards a location.
mp.cameras.new(name, position, rotation, fov);
<br />
</syntaxhighlight>
<br />
 
Version 0.3.7:
==Example==
{{ClientsideCode|
Creates a camera and sets it to look towards a location
<pre>
<div class="header" style="background-color: #AE4040; color: #FFFFFF; border: 2px solid #AE4040;">
<div style="margin: 10px 10px 10px 10px;"><b>Client-Side</b></div>
<syntaxhighlight lang="javascript">
let sceneryCamera = mp.cameras.new('default', new mp.Vector3(-485, 1095.75, 323.85), new mp.Vector3(0,0,0), 40);
let sceneryCamera = mp.cameras.new('default', new mp.Vector3(-485, 1095.75, 323.85), new mp.Vector3(0,0,0), 40);


sceneryCamera.pointAtCoord(402.8664, -996.4108, -98.5); //Changes the rotation of the camera to point towards a location
sceneryCamera.pointAtCoord(402.8664, -996.4108, -98.5); // Changes the rotation of the camera to point towards a location
sceneryCamera.setActive(true);
sceneryCamera.setActive(true);
mp.game.cam.renderScriptCams(true, false, 0, true, false);
mp.game.cam.renderScriptCams(true, false, 0, true, false);
</syntaxhighlight>
</pre>
</div>
}}
<br />
Version 1.1:
{{ClientsideCode|
<pre>
sceneryCamera.pointAtCoord(402.8664, -996.4108, -98.5); // PointAtCoord can't use Vector3 position in version 1.1. Use position.x, position.y, position.z instead.
</pre>
}}
 


==See Also==
==See Also==
{{Camera_definition_c}}
{{Camera_definition_c}}
[[Category:Clientside API]]
[[Category:Camera API]]

Latest revision as of 01:01, 26 January 2021

Creates a camera.

Syntax

mp.cameras.new(name, position, rotation, fov);

Parameters

  • name: String
  • position: Vector3
  • rotation: Vector3
  • fov: Int

Examples

Creates a camera and sets it to look towards a location.

Version 0.3.7:

Client-Side
let sceneryCamera = mp.cameras.new('default', new mp.Vector3(-485, 1095.75, 323.85), new mp.Vector3(0,0,0), 40);

sceneryCamera.pointAtCoord(402.8664, -996.4108, -98.5); // Changes the rotation of the camera to point towards a location
sceneryCamera.setActive(true);
mp.game.cam.renderScriptCams(true, false, 0, true, false);


Version 1.1:

Client-Side
sceneryCamera.pointAtCoord(402.8664, -996.4108, -98.5); // PointAtCoord can't use Vector3 position in version 1.1. Use position.x, position.y, position.z instead.


See Also