Camera::Camera: Difference between revisions

From RAGE Multiplayer Wiki
(Comment for Rage 1.1 added)
(Fixed client-side display code on second example. Cleaned up some grammatical and text display issues.)
Line 13: Line 13:
*'''fov''': {{RageType|Int}}
*'''fov''': {{RageType|Int}}


==Example==
==Examples==
Creates a camera and sets it to look towards a location
Creates a camera and sets it to look towards a location.
<br />
<br />
Version 0.3.7:
{{ClientsideCode|
{{ClientsideCode|
<pre>
<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);


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);
</pre>
</pre>
}}
}}
 
<br />
==Comment Rage 1.1==
Version 1.1:
Creates a camera and sets it to look towards a location
{{ClientsideCode|
{{ClientsideCode|
<pre>
<pre>
sceneryCamera.pointAtCoord(402.8664, -996.4108, -98.5);
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.
pointAtCoord can't use Vector3 position in Rage 1.1, use position.x, position.y, position.z instead.
</pre>
</pre>
}}





Revision as of 07:59, 5 October 2020

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