JSPrismarine
    Preparing search index...

    2D Vector.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    x z

    Accessors

    Methods

    Constructors

    • Create a new Vector2 instance.

      Parameters

      • x: number = 0

        The X coordinate.

      • z: number = 0

        The Z coordinate.

      Returns Vector2

      const vector = new Vector2(10, 20);
      

    Properties

    x: number = 0

    The X coordinate.

    z: number = 0

    The Z coordinate.

    Accessors

    Methods

    • Compare an instance of Vector3 with another.

      Parameters

      • vector: Vector2

        The Vector3 to compare to.

      Returns boolean

      true if they're equal otherwise false.

    • Get the x coordinate.

      Returns number

      The x 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 Z coordinate.

      Parameters

      • z: number

        The Z coordinate.

      Returns void

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

      Parameters

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

        The object containing x and z properties.

      Returns Vector2

      A new Vector2 instance.