Vector3::negative: Difference between revisions
(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....") |
|||
| Line 9: | Line 9: | ||
== Returns == | == Returns == | ||
* {{RageType| | * {{RageType|Vector3Mp}} The opposite vector. | ||
==Example== | ==Example== | ||
Latest revision as of 02:24, 18 June 2019
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
- Functions
- Properties
- Vector3::x
- Vector3::y
- Vector3::z