Vector3::subtract: Difference between revisions

From RAGE Multiplayer Wiki
(Created page with "This function is used to subtract a Vector3 from another Vector3. ==Syntax== <pre> vector.subtract(Vector3 otherVec); </pre> ===Required Arguments=== *'''otherVec:''' Vector...")
 
No edit summary
Line 8: Line 8:
*'''otherVec:''' Vector3: The vector to be subtracted from the callee.
*'''otherVec:''' Vector3: The vector to be subtracted from the callee.


==Example #1==  
==Example==  
{{ServersideCode|
{{ServersideCode|
<pre>
<pre>

Revision as of 05:47, 31 May 2019

This function is used to subtract a Vector3 from another Vector3.

Syntax

vector.subtract(Vector3 otherVec);

Required Arguments

  • otherVec: Vector3: The vector to be subtracted from the callee.

Example

Server-Side
const vec1 = new mp.Vector3(50, 40, 30);
const vec2 = new mp.Vector3(10, 20, 15);

const difference = vec1.subtract(vec2); // difference = {x: 40, y: 20, z: 15}

See Also