Returns the length of this vector.
The length is calculated by the square root of (x * x + y * y + z * z)
.
Returns a copy of this vector with length 1
.
Returns the squared length of this vector.
If you use vector lengths to compare distances, squared lengths are more performant and preferred to use.
X
component of this vector.
Y
component of this vector.
Z
component of this vector.
Shorthand for writing new Vector3(1,1,1)
.
Shorthand for writing new Vector3(0,0,0)
.
Returns the angle in radians from this vector to other
.
angle in radians.
Calculates the cross product of this vector and other
The cross product of two vectors results in a third vector which is perpendicular to the two input vectors. The result's magnitude is equal to the magnitudes of the two inputs multiplied together and then multiplied by the sine of the angle between the inputs. You can determine the direction of the result vector using the "left hand rule".
cross product.
Returns the distance between this vector and other
.
Note: a.dist(other)
is the same as a.sub(b).length
.
distance between vectors.
Divides all components of this vector by divisor d
.
new vector of the divided result.
Calculates the dot product of this vector and other
.
The dot product is a number equal to the lengths of two vectors multiplied together and then multiplied by the cosine of the angle between them.
dot product.
Returns true
if this vector equals v
.
vector to compare this vector against.
Returns a copy of this vector with limited length l
.
limited length vector.
Multiplies each component of this by a number m
.
multiplier.
new vector of the multiplied result.
array representation of this vector.
Calculates the cross product of vector a
and vector b
.
The cross product of two vectors results in a third vector which is perpendicular to the two input vectors. The result's length is equal to the lengths of the two inputs multiplied together and then multiplied by the sine of the angle between the inputs. You can determine the direction of the result vector using the "left hand rule".
cross product.
Returns the length of vector v
.
The length is made up from the square root of (x * x + y * y + z * z)
.
length of v
Represents 3D points and vectors.
Use this class to pass positions and directions to item transforms and perform vector operations.
Note: By default, DX engine uses
Z
as "up".