Class Vector2
Package: @altmp/altv-types
Syntax
Constructors
|
Improve this Doc
View Source
Vector2(number, number)
Declaration
Vector2(x: number, y: number): Vector2
Parameters
Type |
Name |
Description |
number |
x |
|
number |
y |
|
|
Improve this Doc
View Source
Vector2([number | number])
Declaration
Vector2(arr: [number | number]): Vector2
Parameters
Type |
Name |
Description |
[number | number] |
arr |
|
|
Improve this Doc
View Source
Vector2(IVector2)
Declaration
Vector2(obj: IVector2): Vector2
Parameters
|
Improve this Doc
View Source
Vector2(number)
Declaration
Vector2(value: number): Vector2
Parameters
Type |
Name |
Description |
number |
value |
|
Properties
|
Improve this Doc
View Source
x
Declaration
public readonly x: number
Property Value
|
Improve this Doc
View Source
y
Declaration
public readonly y: number
Property Value
|
Improve this Doc
View Source
zero
Declaration
public readonly static zero: Vector2
Property Value
|
Improve this Doc
View Source
one
Declaration
public readonly static one: Vector2
Property Value
|
Improve this Doc
View Source
up
Declaration
public readonly static up: Vector2
Property Value
|
Improve this Doc
View Source
down
Declaration
public readonly static down: Vector2
Property Value
|
Improve this Doc
View Source
left
Declaration
public readonly static left: Vector2
Property Value
|
Improve this Doc
View Source
right
Declaration
public readonly static right: Vector2
Property Value
|
Improve this Doc
View Source
negativeInfinity
Declaration
public readonly static negativeInfinity: Vector2
Property Value
|
Improve this Doc
View Source
positiveInfinity
Declaration
public readonly static positiveInfinity: Vector2
Property Value
Methods
|
Improve this Doc
View Source
toArray()
Declaration
public toArray(): [number | number]
Returns
Type |
Description |
[number | number] |
|
|
Improve this Doc
View Source
toFixed(number)
Declaration
public toFixed(precision: number): Vector2
Parameters
Type |
Name |
Description |
number |
precision |
|
Returns
|
Improve this Doc
View Source
toString()
Declaration
public toString(): string
Returns
|
Improve this Doc
View Source
add(number, number)
Declaration
public add(x: number, y: number): Vector2
Parameters
Type |
Name |
Description |
number |
x |
|
number |
y |
|
Returns
|
Improve this Doc
View Source
add(number)
Declaration
public add(value: number): Vector2
Parameters
Type |
Name |
Description |
number |
value |
|
Returns
|
Improve this Doc
View Source
add([number | number])
Declaration
public add(array: [number | number]): Vector2
Parameters
Type |
Name |
Description |
[number | number] |
array |
|
Returns
|
Improve this Doc
View Source
add(IVector2)
Declaration
public add(vector: IVector2): Vector2
Parameters
Returns
|
Improve this Doc
View Source
sub(number, number)
Declaration
public sub(x: number, y: number): Vector2
Parameters
Type |
Name |
Description |
number |
x |
|
number |
y |
|
Returns
|
Improve this Doc
View Source
sub(number)
Declaration
public sub(value: number): Vector2
Parameters
Type |
Name |
Description |
number |
value |
|
Returns
|
Improve this Doc
View Source
sub([number | number])
Declaration
public sub(array: [number | number]): Vector2
Parameters
Type |
Name |
Description |
[number | number] |
array |
|
Returns
|
Improve this Doc
View Source
sub(IVector2)
Declaration
public sub(vector: IVector2): Vector2
Parameters
Returns
|
Improve this Doc
View Source
div(number, number)
Declaration
public div(x: number, y: number): Vector2
Parameters
Type |
Name |
Description |
number |
x |
|
number |
y |
|
Returns
|
Improve this Doc
View Source
div(number)
Declaration
public div(value: number): Vector2
Parameters
Type |
Name |
Description |
number |
value |
|
Returns
|
Improve this Doc
View Source
div([number | number])
Declaration
public div(array: [number | number]): Vector2
Parameters
Type |
Name |
Description |
[number | number] |
array |
|
Returns
|
Improve this Doc
View Source
div(IVector2)
Declaration
public div(vector: IVector2): Vector2
Parameters
Returns
|
Improve this Doc
View Source
dot(number, number)
Declaration
public dot(x: number, y: number): Vector2
Parameters
Type |
Name |
Description |
number |
x |
|
number |
y |
|
Returns
|
Improve this Doc
View Source
dot(number)
Declaration
public dot(value: number): Vector2
Parameters
Type |
Name |
Description |
number |
value |
|
Returns
|
Improve this Doc
View Source
dot([number | number])
Declaration
public dot(array: [number | number]): Vector2
Parameters
Type |
Name |
Description |
[number | number] |
array |
|
Returns
|
Improve this Doc
View Source
dot(IVector2)
Declaration
public dot(vector: IVector2): Vector2
Parameters
Returns
|
Improve this Doc
View Source
mul(number, number)
Declaration
public mul(x: number, y: number): Vector2
Parameters
Type |
Name |
Description |
number |
x |
|
number |
y |
|
Returns
|
Improve this Doc
View Source
mul(number)
Declaration
public mul(value: number): Vector2
Parameters
Type |
Name |
Description |
number |
value |
|
Returns
|
Improve this Doc
View Source
mul([number | number])
Declaration
public mul(array: [number | number]): Vector2
Parameters
Type |
Name |
Description |
[number | number] |
array |
|
Returns
|
Improve this Doc
View Source
mul(IVector2)
Declaration
public mul(vector: IVector2): Vector2
Parameters
Returns
|
Improve this Doc
View Source
negative()
Declaration
public negative(): Vector2
Returns
|
Improve this Doc
View Source
inverse()
Declaration
public inverse(): Vector2
Returns
|
Improve this Doc
View Source
normalize()
Declaration
public normalize(): Vector2
Returns
|
Improve this Doc
View Source
distanceTo(IVector2)
Declaration
public distanceTo(vector: IVector2): number
Parameters
Returns
|
Improve this Doc
View Source
distanceToSquared(IVector2)
Declaration
public distanceToSquared(vector: IVector2): number
Parameters
Returns
|
Improve this Doc
View Source
angleTo(IVector2)
Declaration
public angleTo(vector: IVector2): number
Parameters
Returns
|
Improve this Doc
View Source
angleToDegrees(IVector2)
Declaration
public angleToDegrees(vector: IVector2): number
Parameters
Returns
|
Improve this Doc
View Source
toRadians()
Declaration
public toRadians(): Vector2
Returns
|
Improve this Doc
View Source
toDegrees()
Declaration
public toDegrees(): Vector2
Returns
|
Improve this Doc
View Source
isInRange(IVector2, number)
Declaration
public isInRange(vector: IVector2, range: number): boolean
Parameters
Type |
Name |
Description |
IVector2 |
vector |
|
number |
range |
|
Returns
|
Improve this Doc
View Source
lerp(IVector2, number)
Declaration
public lerp(vector: IVector2, ratio: number): Vector2
Parameters
Type |
Name |
Description |
IVector2 |
vector |
|
number |
ratio |
|
Returns