Camera::Camera: Difference between revisions

From RAGE Multiplayer Wiki
Line 14: Line 14:


==Example==
==Example==
Creates a camera and sets it to look towards a location
<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">
<syntaxhighlight lang="javascript">
let editorCamera = mp.cameras.new('default', new mp.Vector3(402.8664, -997.5515, -98.5), 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);
editorCamera.pointAtCoord(402.8664, -996.4108, -98.5);
 
editorCamera.setActive(true);
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);
mp.game.cam.renderScriptCams(true, false, 0, true, false);
</syntaxhighlight>
</syntaxhighlight>
</div>


==See Also==
==See Also==
{{Camera_definition_c}}
{{Camera_definition_c}}

Revision as of 05:41, 17 June 2018

Function: Creates a camera.

Parameters

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

Syntax

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

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