Camera::Camera: Difference between revisions

From RAGE Multiplayer Wiki
m (Added categories)
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 7: Line 12:
*'''rotation''': {{RageType|Vector3}}
*'''rotation''': {{RageType|Vector3}}
*'''fov''': {{RageType|Int}}
*'''fov''': {{RageType|Int}}
==Syntax==
<syntaxhighlight lang="javascript">
mp.cameras.new(name, position, rotation, fov);
</syntaxhighlight>


==Example==
==Example==
Line 17: Line 17:
<div class="header" style="background-color: #AE4040; color: #FFFFFF; border: 2px solid #AE4040;">
<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>
<div style="margin: 10px 10px 10px 10px;"><b>Client-Side</b></div>
<syntaxhighlight lang="javascript">
<pre>
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);


Line 23: Line 23:
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>
</div>


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

Revision as of 13:01, 29 September 2018

Creates a camera.

Syntax

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

Parameters

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

Example

Creates a camera and sets it to look towards a location

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);

See Also