Buy Me a Coffee at ko-fi.com

A vector that holds 4 numbers
Can be created using functions in the "vectors" api

Adds the given vector or values to this one, and returns self for chaining

overload 1:
Vector4.add(vec: Vector4): Vector4
typings.2002444081typings.2002444081
Method PropertyFluent DescriptionRepresentation
vec accepts
Return Value
overload 2:
Vector4.add(x: Number, y: Number, z: Number, w: Number): Vector4
typings.-1950496919typings.-1950496919typings.-1950496919typings.-1950496919typings.2002444081
Method PropertyFluent DescriptionRepresentation
x accepts
y accepts
z accepts
w accepts
Return Value

Calls the given function on each element of this vector, and sets the values of the vector to the returns
The current index and its value is given as arguments of the function
Returns self for chaining

overload 1:
Vector4.applyFunc(func: (Number, Integer) -> Number): Vector4
typings.1623631144typings.2002444081
Method PropertyFluent DescriptionRepresentation
func accepts
Return Value

Returns a copy of this vector with its values rounded up

overload 1:
Vector4.ceil(): Vector4
typings.2002444081
Method PropertyFluent DescriptionRepresentation
Return Value

Modifies this vector so that its length is between minLength and maxLength
If the vector has length zero, it is unmodified
Returns self for chaining

overload 1:
Vector4.clampLength(minLength: Number, maxLength: Number): Vector4
typings.-1950496919typings.-1950496919typings.2002444081
Method PropertyFluent DescriptionRepresentation
minLength accepts
maxLength accepts
Return Value

Returns a modified copy of this vector, with its length clamped from minLength to maxLength
If the vector has length zero, then the copy does too

overload 1:
Vector4.clamped(minLength: Number, maxLength: Number): Vector4
typings.-1950496919typings.-1950496919typings.2002444081
Method PropertyFluent DescriptionRepresentation
minLength accepts
maxLength accepts
Return Value

Creates and returns a copy of this vector

overload 1:
Vector4.copy(): Vector4
typings.2002444081
Method PropertyFluent DescriptionRepresentation
Return Value

Divides this vector by the given vector or values, and returns self for chaining

overload 1:
Vector4.div(vec: Vector4): Vector4
typings.2002444081typings.2002444081
Method PropertyFluent DescriptionRepresentation
vec accepts
Return Value
overload 2:
Vector4.div(x: Number, y: Number, z: Number, w: Number): Vector4
typings.-1950496919typings.-1950496919typings.-1950496919typings.-1950496919typings.2002444081
Method PropertyFluent DescriptionRepresentation
x accepts
y accepts
z accepts
w accepts
Return Value

Returns the dot product of this vector with the other

overload 1:
Vector4.dot(vec: Vector4): Number
typings.2002444081typings.-1950496919
Method PropertyFluent DescriptionRepresentation
vec accepts
Return Value

Returns a copy of this vector with its values rounded down

overload 1:
Vector4.floor(): Vector4
typings.2002444081
Method PropertyFluent DescriptionRepresentation
Return Value

Returns the length of this vector

overload 1:
Vector4.length(): Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Return Value

Returns the length of this vector squared
Suitable when you only care about relative lengths, because it avoids a square root

overload 1:
Vector4.lengthSquared(): Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Return Value

Multiplies the given vector or values into this one, and returns self for chaining

overload 1:
Vector4.mul(vec: Vector4): Vector4
typings.2002444081typings.2002444081
Method PropertyFluent DescriptionRepresentation
vec accepts
Return Value
overload 2:
Vector4.mul(x: Number, y: Number, z: Number, w: Number): Vector4
typings.-1950496919typings.-1950496919typings.-1950496919typings.-1950496919typings.2002444081
Method PropertyFluent DescriptionRepresentation
x accepts
y accepts
z accepts
w accepts
Return Value

Modifies this vector so that its length is 1 unless its length was originally 0
Returns self for chaining

overload 1:
Vector4.normalize(): Vector4
typings.2002444081
Method PropertyFluent DescriptionRepresentation
Return Value

Returns a copy of this vector with length 1 unless its length was originally 0

overload 1:
Vector4.normalized(): Vector4
typings.2002444081
Method PropertyFluent DescriptionRepresentation
Return Value

Offsets this vector by the given factor, adding the factor to all components, and returns self for chaining

overload 1:
Vector4.offset(factor: Number): Vector4
typings.-1950496919typings.2002444081
Method PropertyFluent DescriptionRepresentation
factor accepts
Return Value

Reduces this vector modulo the given vector or values, and returns self for chaining

overload 1:
Vector4.reduce(vec: Vector4): Vector4
typings.2002444081typings.2002444081
Method PropertyFluent DescriptionRepresentation
vec accepts
Return Value
overload 2:
Vector4.reduce(x: Number, y: Number, z: Number, w: Number): Vector4
typings.-1950496919typings.-1950496919typings.-1950496919typings.-1950496919typings.2002444081
Method PropertyFluent DescriptionRepresentation
x accepts
y accepts
z accepts
w accepts
Return Value

Resets this vector back to being all zeroes, and returns itself for chaining

overload 1:
Vector4.reset(): Vector4
typings.2002444081
Method PropertyFluent DescriptionRepresentation
Return Value

Scales this vector by the given factor, and returns self for chaining

overload 1:
Vector4.scale(factor: Number): Vector4
typings.-1950496919typings.2002444081
Method PropertyFluent DescriptionRepresentation
factor accepts
Return Value

Sets this vector to have the given values
Nil values are treated as zero
Returns self for chaining

overload 1:
Vector4.set(vec: Vector4): Vector4
typings.2002444081typings.2002444081
Method PropertyFluent DescriptionRepresentation
vec accepts
Return Value
overload 2:
Vector4.set(x: Number, y: Number, z: Number, w: Number): Vector4
typings.-1950496919typings.-1950496919typings.-1950496919typings.-1950496919typings.2002444081
Method PropertyFluent DescriptionRepresentation
x accepts
y accepts
z accepts
w accepts
Return Value

Subtracts the given vector or values from this one, and returns self for chaining

overload 1:
Vector4.sub(vec: Vector4): Vector4
typings.2002444081typings.2002444081
Method PropertyFluent DescriptionRepresentation
vec accepts
Return Value
overload 2:
Vector4.sub(x: Number, y: Number, z: Number, w: Number): Vector4
typings.-1950496919typings.-1950496919typings.-1950496919typings.-1950496919typings.2002444081
Method PropertyFluent DescriptionRepresentation
x accepts
y accepts
z accepts
w accepts
Return Value

Returns a copy of this vector, in degrees

overload 1:
Vector4.toDeg(): Vector4
typings.2002444081
Method PropertyFluent DescriptionRepresentation
Return Value

Returns a copy of this vector, in radians

overload 1:
Vector4.toRad(): Vector4
typings.2002444081
Method PropertyFluent DescriptionRepresentation
Return Value

Transforms this vector by the given matrix, and returns self for chaining

overload 1:
Vector4.transform(mat: Matrix4): Vector4
typings.-1789003661typings.2002444081
Method PropertyFluent DescriptionRepresentation
mat accepts
Return Value

Returns this vector's values as separate numbers

overload 1:
Vector4.unpack(): Varargs
typings.1901216868
Method PropertyFluent DescriptionRepresentation
Return Value

The fourth coordinate of this vector
Can also be gotten with the indices "a" and [4]

field signature:
Vector4.w: Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Field Type

The first coordinate of this vector
Can also be gotten with the indices "r" and [1]

field signature:
Vector4.x: Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Field Type

The second coordinate of this vector
Can also be gotten with the indices "g" and [2]

field signature:
Vector4.y: Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Field Type

The third coordinate of this vector
Can also be gotten with the indices "b" and [3]

field signature:
Vector4.z: Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Field Type