Creates a new Vector3 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 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
Multiplies this vector by a 4x4 matrix
The 4x4 matrix to apply
Returns this vector for method chaining
Creates a new vector with the same values as this vector
A new Vector3 instance with copied values
Copies values from another vector into this vector
The vector to copy from
Returns this vector for method chaining
Computes the cross product of this vector with another vector
The other vector for the cross product
Returns this vector with cross product result for method chaining
Computes the distance between this vector and another vector
The other vector to measure distance to
The distance between the vectors
Computes the squared distance between this vector and another vector (avoids sqrt for performance)
The other vector to measure distance to
The squared distance between the vectors
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
Computes the dot product of this vector with another vector
The other vector for the dot product
The dot product result
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
Rotates the vector around an axis by a given angle Based on Rodrigues' rotation formula
The rotation angle in radians
The rotation axis
Returns this vector for method chaining
Sets the components of this vector
The new x component
The new y component
The new z 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]
Transforms the direction of this vector by a 4x4 matrix
The 4x4 matrix to apply
Returns this vector for method chaining
Normalizes this vector to unit length (length = 1)
Returns this vector for method chaining
Represents a 3D vector with x, y, and z components. Provides various vector operations for 3D mathematics and transformations.