Creates a new Vector4 instance
The x component of the vector. Defaults to 0
The y component of the vector. Defaults to 0
The z component of the vector. Defaults to 0
The w component of the vector. Defaults to 0
The w component of the vector
The x component of the vector
The y component of the vector
The z component of the vector
Adds another vector to this vector
The vector to add
Returns this vector for method chaining
Applies a 4x4 matrix transformation to this vector
The 4x4 matrix to apply
Returns this vector for method chaining
Creates a new vector with the same values as this vector
A new Vector4 instance with copied values
Copies values from another vector into this vector
The vector to copy from
Returns this vector for method chaining
Divides this vector component-wise by another vector
The vector to divide by
Returns this vector for method chaining
Divides this vector by a scalar
The scalar value to divide by
Returns this vector for method chaining
Compares this vector with another vector for equality
The vector to compare with
True if vectors are equal, false otherwise
Computes the length (magnitude) of this vector
The length of the vector
Computes the squared length of this vector (avoids sqrt for performance)
The squared length of the vector
Multiplies this vector component-wise by another vector
The vector to multiply by
Returns this vector for method chaining
Multiplies this vector by a scalar
The scalar value to multiply by
Returns this vector for method chaining
Sets the components of this vector
The new x component
The new y component
The new z component
The new w component
Returns this vector for method chaining
Sets the w component of this vector
The new w component
Returns this vector for method chaining
Sets the x component of this vector
The new x component
Returns this vector for method chaining
Sets the y component of this vector
The new y component
Returns this vector for method chaining
Sets the z component of this vector
The new z component
Returns this vector for method chaining
Subtracts another vector from this vector
The vector to subtract
Returns this vector for method chaining
Converts this vector to an array of its components
An array containing the vector's components [x, y, z, w]
Represents a 4D vector with x, y, z, and w components. Provides various vector operations for 4D mathematics and transformations.