Readonly
xReadonly
yReadonly
zStatic
Readonly
DownStatic
Readonly
EastStatic
Readonly
NorthStatic
Readonly
SouthStatic
Readonly
UpStatic
Readonly
WestStatic
Readonly
ZeroAdds three numbers to the current vector.
The x component to be added.
The y component to be added.
The z component to be added.
The updated vector after addition.
Adds another Vector3 to the current vector.
The Vector3 to be added.
The updated vector after addition.
Adds a Direction to the current vector.
The Direction to be added.
The updated vector after addition.
Adds an array of numbers to the current vector.
The array of numbers to be added.
The updated vector after addition.
Checks if the current vector is almost equal to another vector defined by three numbers, within a given tolerance (delta).
The x component of the other vector.
The y component of the other vector.
The z component of the other vector.
The maximum allowed difference between corresponding components.
True if the vectors are almost equal; otherwise, false.
Checks if the current vector is almost equal to another Vec3 within a given tolerance (delta).
The Vec3 to compare.
The maximum allowed difference between corresponding components.
True if the vectors are almost equal; otherwise, false.
Checks if the current vector is almost equal to another Vector3 within a given tolerance (delta).
The Vector3 to compare.
The maximum allowed difference between corresponding components.
True if the vectors are almost equal; otherwise, false.
Checks if the current vector is almost equal to a Direction within a given tolerance (delta).
The Direction to compare.
The maximum allowed difference between corresponding components.
True if the vectors are almost equal; otherwise, false.
Checks if the current vector is almost equal to a vector represented by an array of numbers, within a given tolerance (delta).
The array of numbers representing the vector.
The maximum allowed difference between corresponding components.
True if the vectors are almost equal; otherwise, false.
Computes the angle (in radians) between the current vector and a vector specified by three numbers.
The x component of the other vector.
The y component of the other vector.
The z component of the other vector.
The angle in radians between the two vectors.
Computes the angle (in radians) between the current vector and another Vec3.
The Vec3 to compute the angle with.
The angle in radians between the two vectors.
Computes the angle (in radians) between the current vector and another Vector3.
The Vector3 to compute the angle with.
The angle in radians between the two vectors.
Computes the angle (in radians) between the current vector and a Direction.
The Direction to compute the angle with.
The angle in radians between the two vectors.
Computes the angle (in radians) between the current vector and a vector represented by an array of numbers.
The array of numbers representing the other vector.
The angle in radians between the two vectors.
Ceils the X, Y, and Z components of the vector.
A new vector with the ceiled components.
Creates a copy of the current vector.
A new vector with the same values as the current vector.
Computes the cross product of the current vector with three numbers.
A cross product is a vector that is perpendicular to both vectors.
The x component of the other vector.
The y component of the other vector.
The z component of the other vector.
A new vector representing the cross product.
Computes the cross product of the current vector with another Vector3.
A cross product is a vector that is perpendicular to both vectors.
The Vector3 to be crossed.
A new vector representing the cross product.
Computes the cross product of the current vector with a Direction.
A cross product is a vector that is perpendicular to both vectors.
The Direction to be crossed.
A new vector representing the cross product.
Computes the cross product of the current vector with an array of numbers.
A cross product is a vector that is perpendicular to both vectors.
The array of numbers representing a vector.
A new vector representing the cross product.
Computes the distance between the current vector and a vector represented by three numbers.
The x component of the other vector.
The y component of the other vector.
The z component of the other vector.
The distance between the two vectors.
Computes the distance between the current vector and another Vec3.
The Vec3 to measure the distance to.
The distance between the two vectors.
Computes the distance between the current vector and another Vector3.
The Vector3 to measure the distance to.
The distance between the two vectors.
Computes the distance between the current vector and a Direction.
The Direction to measure the distance to.
The distance between the two vectors.
Computes the distance between the current vector and a vector represented by an array of numbers.
The array of numbers representing the other vector.
The distance between the two vectors.
Computes the squared distance between the current vector and a vector represented by three numbers. This is faster than computing the actual distance and can be useful for comparison purposes.
The x component of the other vector.
The y component of the other vector.
The z component of the other vector.
The squared distance between the two vectors.
Computes the squared distance between the current vector and another Vec3. This is faster than computing the actual distance and can be useful for comparison purposes.
The Vec3 to measure the squared distance to.
The squared distance between the two vectors.
Computes the squared distance between the current vector and another Vector3. This is faster than computing the actual distance and can be useful for comparison purposes.
The Vector3 to measure the squared distance to.
The squared distance between the two vectors.
Computes the squared distance between the current vector and a Direction. This is faster than computing the actual distance and can be useful for comparison purposes.
The Direction to measure the squared distance to.
The squared distance between the two vectors.
Computes the squared distance between the current vector and a vector represented by an array of numbers. This is faster than computing the actual distance and can be useful for comparison purposes.
The array of numbers representing the other vector.
The squared distance between the two vectors.
Calculates the shortest distance between a point (represented by this Vector3 instance) and a line segment.
This method finds the perpendicular projection of the point onto the line defined by the segment. If this projection lies outside the line segment, then the method calculates the distance from the point to the nearest segment endpoint.
The starting point of the line segment.
The ending point of the line segment.
The shortest distance between the point and the line segment.
Divides the current vector by three numbers.
The divisor for the x component.
The divisor for the y component.
The divisor for the z component.
The updated vector after division.
Divides the current vector by another Vector3.
The Vector3 divisor.
The updated vector after division.
Divides the current vector by a Direction.
The Direction divisor.
The updated vector after division.
Divides the current vector by an array of numbers.
The array divisor.
The updated vector after division.
Divides the current vector by a scalar.
The scalar divisor.
The updated vector after division.
Computes the dot product of the current vector with a vector specified by three numbers.
The x component of the other vector.
The y component of the other vector.
The z component of the other vector.
The dot product of the two vectors.
Computes the dot product of the current vector with another Vec3.
The Vec3 to compute the dot product with.
The dot product of the two vectors.
Computes the dot product of the current vector with another Vector3.
The Vector3 to compute the dot product with.
The dot product of the two vectors.
Computes the dot product of the current vector with a Direction.
The Direction to compute the dot product with.
The dot product of the two vectors.
Computes the dot product of the current vector with a vector represented by an array of numbers.
The array of numbers representing the other vector.
The dot product of the two vectors.
Returns a new vector offset from the current vector down by 1 block.
A new vector offset from the current vector down by 1 block.
Returns a new vector offset from the current vector east by 1 block.
A new vector offset from the current vector east by 1 block.
Checks if the current vector is exactly equal to another vector defined by three numbers.
The x component of the other vector.
The y component of the other vector.
The z component of the other vector.
True if the vectors are exactly equal; otherwise, false.
Checks if the current vector is exactly equal to another Vec3.
The Vec3 to compare.
True if the vectors are exactly equal; otherwise, false.
Checks if the current vector is exactly equal to another Vector3.
The Vector3 to compare.
True if the vectors are exactly equal; otherwise, false.
Checks if the current vector is exactly equal to a Direction.
The Direction to compare.
True if the vectors are exactly equal; otherwise, false.
Checks if the current vector is exactly equal to a vector represented by an array of numbers.
The array of numbers representing the vector.
True if the vectors are exactly equal; otherwise, false.
Floors the X, Y, and Z components of the vector.
A new vector with the floored components.
Checks if the current vector is equal to the zero vector.
true if the vector is equal to the zero vector, else returns false.
Computes the length (magnitude) of the vector.
The length of the vector.
Computes the squared length of the vector. This is faster than computing the actual length and can be useful for comparison purposes.
The squared length of the vector.
Computes the linear interpolation between the current vector and another vector, when t is in the range [0, 1]. Computes the extrapolation when t is outside this range.
The other vector.
The interpolation factor.
A new vector after performing the lerp operation.
Multiplies the current vector by three numbers.
The multiplier for the x component.
The multiplier for the y component.
The multiplier for the z component.
The updated vector after multiplication.
Multiplies the current vector by another Vector3.
The Vector3 multiplier.
The updated vector after multiplication.
Multiplies the current vector by a Direction.
The Direction multiplier.
The updated vector after multiplication.
Multiplies the current vector by an array of numbers.
The array multiplier.
The updated vector after multiplication.
Multiplies the current vector by a scalar.
The scalar multiplier.
The updated vector after multiplication.
Normalizes the vector to have a length (magnitude) of 1. Normalized vectors are often used as a direction vectors.
The normalized vector.
Returns a new vector offset from the current vector north by 1 block.
A new vector offset from the current vector north by 1 block.
Computes the projection of the current vector onto a vector specified by three numbers. This method finds how much of the current vector lies in the direction of the given vector.
The x component of the vector to project onto.
The y component of the vector to project onto.
The z component of the vector to project onto.
A new vector representing the projection of the current vector.
Computes the projection of the current vector onto another Vector3. This method finds how much of the current vector lies in the direction of the given vector.
The Vector3 to project onto.
A new vector representing the projection of the current vector.
Computes the projection of the current vector onto a Direction. This method finds how much of the current vector lies in the direction of the given vector.
The Direction to project onto.
A new vector representing the projection of the current vector.
Computes the projection of the current vector onto a vector represented by an array of numbers. This method finds how much of the current vector lies in the direction of the given vector.
The array of numbers representing the vector to project onto.
A new vector representing the projection of the current vector.
Computes the reflection of the current vector against a normal vector specified by three numbers. Useful for simulating light reflections or bouncing objects.
The x component of the normal vector.
The y component of the normal vector.
The z component of the normal vector.
A new vector representing the reflection of the current vector.
Computes the reflection of the current vector against another Vector3 normal vector. Useful for simulating light reflections or bouncing objects.
The Vector3 representing the normal vector.
A new vector representing the reflection of the current vector.
Computes the reflection of the current vector against a Direction normal vector. Useful for simulating light reflections or bouncing objects.
The Direction representing the normal vector.
A new vector representing the reflection of the current vector.
Computes the reflection of the current vector against a normal vector represented by an array of numbers. Useful for simulating light reflections or bouncing objects.
The array of numbers representing the normal vector.
A new vector representing the reflection of the current vector.
Rotates the current normalized vector by a given angle around a given axis.
The axis of rotation.
The angle of rotation in degrees.
The rotated vector.
Rounds the X, Y, and Z components of the vector.
A new vector with the rounded components.
Scales the current vector by a scalar.
The scalar to scale the vector by.
The updated vector after scaling.
Computes the spherical linear interpolation between the current vector and another vector, when t is in the range [0, 1]. Computes the extrapolation when t is outside this range.
The other vector.
The interpolation factor.
A new vector after performing the slerp operation.
Returns a new vector offset from the current vector south by 1 block.
A new vector offset from the current vector south by 1 block.
Subtracts three numbers from the current vector.
The x component to be subtracted.
The y component to be subtracted.
The z component to be subtracted.
The updated vector after subtraction.
Subtracts another Vector3 from the current vector.
The Vector3 to be subtracted.
The updated vector after subtraction.
Subtracts a Direction from the current vector.
The Direction to be subtracted.
The updated vector after subtraction.
Subtracts an array of numbers from the current vector.
The array of numbers to be subtracted.
The updated vector after subtraction.
Converts the vector to an array containing the X, Y, and Z components of the vector.
An array containing the X, Y, and Z components of the vector.
Returns a new vector with the X, Y, and Z components rounded to the nearest block location.
Converts the vector to a direction. If the vector is not a unit vector, then it will be normalized and rounded to the nearest direction.
Converts the vector to a string representation.
Optional
format: "long" | "short"The format of the string representation. Defaults to "long".
Optional
separator: stringThe separator to use between components. Defaults to ", ".
The string representation of the vector.
Converts the normal vector to yaw and pitch values.
A Vector2 containing the yaw and pitch values.
Returns a new vector offset from the current vector up by 1 block.
A new vector offset from the current vector up by 1 block.
Updates the X, Y, and Z components of the vector.
The function to use to update the X value.
The function to use to update the Y value.
The function to use to update the Z value.
The updated vector with the new values.
Returns a new vector offset from the current vector west by 1 block.
A new vector offset from the current vector west by 1 block.
Static
fromStatic
fromCreates a new direction vector from yaw and pitch values.
The yaw and pitch values in degrees.
A new vector representing the direction.
Creates a new direction vector from yaw and pitch values.
The yaw value in degrees.
The pitch value in degrees.
A new vector representing the direction.
Remarks
X component of this vector.