Vector3::negative

From RAGE Multiplayer Wiki
Revision as of 02:24, 18 June 2019 by Micaww (talk | contribs) (→‎Returns)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

  • Vector3Mp 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