Vector3
Implements
- Vector
Index
Constructors
constructor
Parameters
vx: number
vy: number
vz: number
Returns Vector3
Properties
x
X coord of the vector
y
Y coord of the vector
z
Z coord of the vector
staticreadonlyDOWN
staticreadonlyEAST
staticreadonlyNORTH
staticreadonlySOUTH
staticreadonlyUP
staticreadonlyWEST
Methods
add
Adds vector.
Parameters
vx: number
vy: number
vz: number
Returns Vector3
result vector.
addScaled
Adds vector scaled by factor.
Parameters
vector: Vector
vector to add.
scale: number
scale factor
Returns Vector3
result vector.
copy
Copies coords to a new vector.
Returns Vector3
vector copy.
cross
Calculates cross product of vectors.
Parameters
vx: number
vy: number
vz: number
Returns Vector3
result vector.
distance
Calculates distance to another point.
Parameters
vx: number
x coord
vy: number
y coord
vz: number
z coord
Returns number
distance
distanceSquared
Calculates squared distance to another point.
Parameters
vx: number
x coord
vy: number
y coord
vz: number
z coord
Returns number
squared distance
dot
Parameters
vx: number
vy: number
vz: number
Returns number
dot product of vectors.
length
Returns number
vector length.
lengthSquared
Returns number
vector length squared
negate
Multiplies vector coords by -1.
Returns Vector3
opposite vector.
normalize
Normalizes vector.
Returns Vector3
normalized vector.
scale
Scales vector coords by factor.
Parameters
factor: number
scaling factor
Returns Vector3
scaled vector
scaleTo
Scales vector length to specified value.
Parameters
len: number
target length
Returns Vector3
scaled vector
set
Sets vector coords.
Parameters
vx: number
vy: number
vz: number
Returns Vector3
sub
Substracts vector.
Parameters
vx: number
vy: number
vz: number
Returns Vector3
result vector.
toString
Returns string
staticgetDirection
Parameters
side: number
block side
Returns Vector3
direction vector for specified side
Class which represents three-dimensional vector and basic operations with it.