Vector3 wrapper class which can be used as a Vector3 for APIs on @minecraft/server which require a Vector, but also contain additional helper methods. This is an alternative to using the core Vector 3 utility methods directly, for those who prefer a more object-oriented approach. This version of the class is mutable and changes state inline.

For an immutable version of the build, use ImmutableVector3Builder.

Hierarchy

  • Vector3Builder

Implements

Constructors

Properties

x: number

Remarks

X component of this vector.

y: number

Remarks

Y component of this vector.

z: number

Remarks

Z component of this vector.

Methods

  • distance

    Calculate the distance between two vectors

    Parameters

    Returns number

  • dot

    Computes the dot product of this and the passed in vector.

    Parameters

    Returns number

  • equals

    Check the equality of two vectors

    Parameters

    Returns boolean

  • lerp

    Constructs a new vector using linear interpolation on each component from two vectors.

    Parameters

    Returns Vector3Builder

  • magnitude

    The magnitude of the vector

    Returns number

  • slerp

    Constructs a new vector using spherical linear interpolation on each component from two vectors.

    Parameters

    Returns Vector3Builder

  • toString

    Create a string representation of a vector

    Parameters

    • Optional options: {
          decimals?: number;
          delimiter?: string;
      }
      Optional
      • Optional decimals?: number
      • Optional delimiter?: string

    Returns string