Alternate name for the w component.
Alternate name for the z component.
Alternate name for the y component.
Returns the length of the vector.
Returns the squared length of the vector.
Alternate name for the x component.
w component of the vec4.
x component of the vec4.
y component of the vec4.
z component of the vec4.
Returns a copy of the vector with its length clamped to length.
Clamps this vector's length to length in place.
Returns a copy of this vector.
Like distance(), but returns the squared distance between vectors.
Sets the x, y, z, and w components of this vector to scalar.
StaticlerpLinearly interpolates this vector towards target by factor t in place.
StaticmaxStaticminMoves this vector towards point by magnitude in place.
Returns a copy of the vector with its length scaled to 1.
Scales this vector's length to 1 in place.
StaticoneReturns the vector (1, 1, 1, 1).
Projects this vector onto the plane defined by planeNormal in place.
Reflects this vector across the plane defined by planeNormal in place.
Alternative to setXYZW. Sets the x, y, z and w components of this vector. Omit parameters or pass null or undefined to leave a component unchanged.
Optionalr: numberOptionalg: numberOptionalb: numberOptionala: numberSets the x, y, z, and w components of this vector. Omit parameters or pass null or undefined to leave a component unchanged.
Optionalx: numberOptionaly: numberOptionalz: numberOptionalw: numberReturns a string representation of the vector.
Multiplies the components of this vector by scale in place.
StaticzeroReturns the vector (0, 0, 0, 0).
A four dimensional vector. Vectors can only store finite numbers in the range Number.MIN_VALUE to Number.MAX_VALUE.
Example