Vector4
Defined in: server/api.d.ts:8956
Mutable four-dimensional vector.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Vector4(
x,y,z,w):Vector4
Defined in: server/api.d.ts:8964
Creates a vector from four numeric components.
Parameters
Section titled “Parameters”number
Initial X component.
number
Initial Y component.
number
Initial Z component.
number
Initial W component.
Returns
Section titled “Returns”Vector4
Methods
Section titled “Methods”add(
other):this
Defined in: server/api.d.ts:9001
Adds another vector to this vector in place.
Parameters
Section titled “Parameters”Vector4
Vector to add component-wise.
Returns
Section titled “Returns”this
This mutated vector for chaining.
clone()
Section titled “clone()”clone():
Vector4
Defined in: server/api.d.ts:9066
Creates an independent copy of this vector.
Returns
Section titled “Returns”Vector4
New vector with the same components.
distance()
Section titled “distance()”distance(
other):number
Defined in: server/api.d.ts:9036
Computes Euclidean distance to another vector.
Parameters
Section titled “Parameters”Vector4
Vector to measure from this vector.
Returns
Section titled “Returns”number
Distance between the two vectors.
div(
scalar):this
Defined in: server/api.d.ts:9022
Divides this vector by a scalar in place.
Parameters
Section titled “Parameters”scalar
Section titled “scalar”number
Divisor applied to every component; must be non-zero.
Returns
Section titled “Returns”this
This mutated vector for chaining.
dot(
other):number
Defined in: server/api.d.ts:9029
Computes the dot product without changing either vector.
Parameters
Section titled “Parameters”Vector4
Vector used for the dot product.
Returns
Section titled “Returns”number
Scalar dot product.
lerp()
Section titled “lerp()”lerp(
target,t):this
Defined in: server/api.d.ts:9050
Linearly interpolates this vector toward a target in place.
Parameters
Section titled “Parameters”target
Section titled “target”Vector4
Destination vector.
number
Interpolation factor; 0 keeps the current value and 1 reaches target.
Returns
Section titled “Returns”this
This mutated vector for chaining.
mul(
scalar):this
Defined in: server/api.d.ts:9015
Multiplies this vector by a scalar in place.
Parameters
Section titled “Parameters”scalar
Section titled “scalar”number
Multiplier applied to every component.
Returns
Section titled “Returns”this
This mutated vector for chaining.
normalize()
Section titled “normalize()”normalize():
this
Defined in: server/api.d.ts:9042
Normalizes this vector in place; a zero vector remains unchanged.
Returns
Section titled “Returns”this
This mutated vector for chaining.
set(
x,y,z,w):this
Defined in: server/api.d.ts:9060
Replaces all components in place.
Parameters
Section titled “Parameters”number
Replacement X component.
number
Replacement Y component.
number
Replacement Z component.
number
Replacement W component.
Returns
Section titled “Returns”this
This mutated vector for chaining.
sub(
other):this
Defined in: server/api.d.ts:9008
Subtracts another vector from this vector in place.
Parameters
Section titled “Parameters”Vector4
Vector to subtract component-wise.
Returns
Section titled “Returns”this
This mutated vector for chaining.
toJSON()
Section titled “toJSON()”toJSON():
object
Defined in: server/api.d.ts:9078
Converts this vector to a plain object for JSON.stringify.
Returns
Section titled “Returns”object
Object containing the current components.
w:
number
x:
number
y:
number
z:
number
toString()
Section titled “toString()”toString():
string
Defined in: server/api.d.ts:9072
Formats this vector for logging and debugging.
Returns
Section titled “Returns”string
Text in Vector4(x, y, z, w) form.
staticone():Vector4
Defined in: server/api.d.ts:9090
Creates a vector whose components are one.
Returns
Section titled “Returns”Vector4
New Vector4(1, 1, 1, 1).
zero()
Section titled “zero()”
staticzero():Vector4
Defined in: server/api.d.ts:9084
Creates a zero vector.
Returns
Section titled “Returns”Vector4
New Vector4(0, 0, 0, 0).
Properties
Section titled “Properties”length
Section titled “length”
readonlylength:number
Defined in: server/api.d.ts:8989
Read-only Euclidean magnitude of this vector.
lengthSquared
Section titled “lengthSquared”
readonlylengthSquared:number
Defined in: server/api.d.ts:8994
Read-only squared magnitude, avoiding a square-root calculation.
w:
number
Defined in: server/api.d.ts:8984
Mutable W component.
x:
number
Defined in: server/api.d.ts:8969
Mutable X component.
y:
number
Defined in: server/api.d.ts:8974
Mutable Y component.
z:
number
Defined in: server/api.d.ts:8979
Mutable Z component.