Vector3::negative

From RAGE Multiplayer Wiki
Revision as of 06:42, 31 May 2019 by Micaww (talk | contribs) (Created page with "This function returns the opposite of a Vector3 by flipping the sign of each partial. The same affect can be achieved by multiplying a vector by -1. ==Syntax== <pre> vector....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function returns the opposite of a Vector3 by flipping the sign of each partial.

The same affect can be achieved by multiplying a vector by -1.

Syntax

vector.negative();

Returns

  • number The opposite vector.

Example

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

const opposite1 = vec1.negative(); // { x: -10, y: -30, z: -100 }
const opposite2 = vec2.negative(); // { x: 50, y: 30, z: -40 };

See Also