Script API - v1.26.0.29
    Preparing search index...

    Class Vector2Builder

    Vector2 wrapper class which can be used as a Vector2 for APIs on @minecraft/server which require a Vector2.

    Implements

    Index

    Constructors

    Properties

    x: number

    X component of the two-dimensional vector.

    y: number

    Y component of the two-dimensional vector.

    Methods

    • add

      Adds the vector v to this, returning itself.

      Parameters

      Returns this

    • Assigns the values of the passed in vector to this vector. Returns itself.

      Parameters

      Returns this

    • clamp

      Clamps the components of a vector to limits to produce a new vector

      Parameters

      Returns this

    • 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

    • floor

      Floor the components of a vector to produce a new vector

      Returns this

    • lerp

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

      Parameters

      Returns this

    • magnitude

      The magnitude of the vector

      Returns number

    • multiply

      Element-wise multiplication of two vectors together. Not to be confused with Vector2Builder.dot product

      Parameters

      Returns this

    • normalize

      Normalizes this vector, returning itself.

      Returns this

    • scale

      Scales this by the passed in value, returning itself.

      Parameters

      • val: number

      Returns this

    • slerp

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

      Parameters

      Returns this

    • subtract

      Subtracts the vector v from this, returning itself.

      Parameters

      Returns this

    • Returns a string representation of an object.

      Parameters

      • Optionaloptions: { decimals?: number; delimiter?: string }

      Returns string