Vector3::negative
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.
Contents
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
- Functions
- Properties
- Vector3::x
- Vector3::y
- Vector3::z