Skip to main content

Vectors

Create Vector​

vector.create

Construct the vector with provided double components.

InTypeWhat it is
XNumberX component
YNumberY component
ZNumberZ component
OutTypeWhat it is
VectorVectorRepresents a mutable vector.

Direction Between Points​

vector.direction

The vector pointing from one point to another

InTypeWhat it is
FromVectorWhere it starts
ToVectorWhere it points
OutTypeWhat it is
ResultVectorThe vector from start to end

Distance Between Points​

vector.distance

Distance between two points. Uses a square root; prefer Distance Squared for comparisons

InTypeWhat it is
FirstVectorA point
SecondVectorAnother point
OutTypeWhat it is
ResultNumberThe distance between both

Mutate Vector​

vector.mutate

Changes the properties of a Vector that are given, the others stay as they are, and gives every property's value after the change

InTypeWhat it is
VectorVectorRepresents a mutable vector.
X (optional)NumberSet the X component.
Y (optional)NumberSet the Y component.
Z (optional)NumberSet the Z component.
OutTypeWhat it is
Block XIntegerGets the floored value of the X component, indicating the block that this vector is contained with.
Block YIntegerGets the floored value of the Y component, indicating the block that this vector is contained with.
Block ZIntegerGets the floored value of the Z component, indicating the block that this vector is contained with.
NormalizedBooleanReturns if a vector is normalized
XNumberGets the X component.
YNumberGets the Y component.
ZNumberGets the Z component.
ZeroBooleanCheck whether or not each component of this vector is equal to 0.

Goes on with: Next

Normalize Vector​

vector.normalize

A vector of length 1 pointing the same way

InTypeWhat it is
ValueVectorA vector
OutTypeWhat it is
ResultVectorThe same direction with length 1

Read Vector​

vector.read

Reads the properties of a Vector

InTypeWhat it is
VectorVectorRepresents a mutable vector.
OutTypeWhat it is
Block XIntegerGets the floored value of the X component, indicating the block that this vector is contained with.
Block YIntegerGets the floored value of the Y component, indicating the block that this vector is contained with.
Block ZIntegerGets the floored value of the Z component, indicating the block that this vector is contained with.
NormalizedBooleanReturns if a vector is normalized
XNumberGets the X component.
YNumberGets the Y component.
ZNumberGets the Z component.
ZeroBooleanCheck whether or not each component of this vector is equal to 0.

Squared Distance Between Points​

vector.distance_squared

Squared distance between two points

InTypeWhat it is
FirstVectorA point
SecondVectorAnother point
OutTypeWhat it is
ResultNumberThe distance between both, squared; cheaper when only comparing