@minecraft/math
    Preparing search index...

    Class Vector3Utils

    Utilities operating on Vector3 objects. All methods are static and do not modify the input objects.

    Index

    Constructors

    Methods

    • add

      Add two vectors to produce a new vector

      Parameters

      • v1: Vector3
      • v2: Partial<Vector3>

      Returns Vector3

    • clamp

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

      Parameters

      • v: Vector3
      • Optionallimits: { max?: Partial<Vector3>; min?: Partial<Vector3> }

      Returns Vector3

    • cross

      Calculate the cross product of two vectors. Returns a new vector.

      Parameters

      • a: Vector3
      • b: Vector3

      Returns Vector3

    • distance

      Calculate the distance between two vectors

      Parameters

      • a: Vector3
      • b: Vector3

      Returns number

    • dot

      Calculate the dot product of two vectors

      Parameters

      • a: Vector3
      • b: Vector3

      Returns number

    • equals

      Check the equality of two vectors

      Parameters

      • v1: Vector3
      • v2: Vector3

      Returns boolean

    • floor

      Floor the components of a vector to produce a new vector

      Parameters

      • v: Vector3

      Returns Vector3

    • lerp

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

      Parameters

      • a: Vector3
      • b: Vector3
      • t: number

      Returns Vector3

    • magnitude

      The magnitude of a vector

      Parameters

      • v: Vector3

      Returns number

    • multiply

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

      Parameters

      • a: Vector3
      • b: Vector3

      Returns Vector3

    • normalize

      Takes a vector 3 and normalizes it to a unit vector

      Parameters

      • v: Vector3

      Returns Vector3

    • rotateX

      Rotates the vector around the x axis counterclockwise (left hand rule)

      Parameters

      • v: Vector3
      • a: number

        Angle in radians

      Returns Vector3

    • rotateY

      Rotates the vector around the y axis counterclockwise (left hand rule)

      Parameters

      • v: Vector3
      • a: number

        Angle in radians

      Returns Vector3

    • rotateZ

      Rotates the vector around the z axis counterclockwise (left hand rule)

      Parameters

      • v: Vector3
      • a: number

        Angle in radians

      Returns Vector3

    • scale

      Multiple all entries in a vector by a single scalar value producing a new vector

      Parameters

      • v1: Vector3
      • scale: number

      Returns Vector3

    • slerp

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

      Parameters

      • a: Vector3
      • b: Vector3
      • t: number

      Returns Vector3

    • subtract

      Subtract two vectors to produce a new vector (v1-v2)

      Parameters

      • v1: Vector3
      • v2: Partial<Vector3>

      Returns Vector3

    • toString

      Create a string representation of a vector3

      Parameters

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

      Returns string