JSPrismarine
    Preparing search index...

    3D Vector.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    x y z

    Accessors

    Methods

    Constructors

    • Create a new Vector3 instance.

      Parameters

      • x: number

        The X coordinate.

      • y: number

        The Y coordinate.

      • z: number

        The Z coordinate.

      Returns Vector3

      const vector = new Vector3(10, 20, 30);
      

    Properties

    x: number = 0

    The X coordinate.

    y: number

    The Y coordinate.

    z: number = 0

    The Z coordinate.

    Accessors

    Methods

    • Compare an instance of Vector3 with another.

      Parameters

      • vector: Vector3

        The Vector3 to compare to.

      Returns boolean

      true if they're equal otherwise false.

    • Returns a new Vector3 with each component rounded down to the nearest integer.

      Returns Vector3

      A new Vector3 with rounded down components.

    • Get the x coordinate.

      Returns number

      The x coordinate's value.

    • Get the y coordinate.

      Returns number

      The y coordinate's value.

    • Get the z coordinate.

      Returns number

      The z coordinate's value.

    • Set the X coordinate.

      Parameters

      • x: number

        The X coordinate.

      Returns void

      await entity.setX(10);
      
    • Set the Y coordinate.

      Parameters

      • y: number

        The Y coordinate.

      Returns void

      entity.setY(10);
      
    • Set the Z coordinate.

      Parameters

      • z: number

        The Z coordinate.

      Returns void

      await entity.setZ(10);
      
    • Creates a new Vector3 instance from an object with x, y, and z properties.

      Parameters

      • obj: { x: number; y: number; z: number }

        The object containing x, y, and z properties.

      Returns Vector3

      A new Vector3 instance.