@game-vir/entity - v15.1.1
    Preparing search index...

    Class Vector

    A vector (combination of magnitude and angle) definition. This can be defined in the following ways:

    • Vector.fromPoints()
    • Vector.fromComponents()
    • new Vector()
    Index

    Constructors

    • Parameters

      • magnitude: number

        The vector's original magnitude. (This can be modified after Vector construction.)

      • angle: Angle

        The vector's original angle. (This can be modified after Vector construction.)

      • options: undefined | { digits: undefined | number }

        Vector options. Set to undefined to disable all options.

        • undefined
        • { digits: undefined | number }
          • digits: undefined | number

            Number of digits to round all values to. Set to undefined to disable rounding.

      Returns Vector

    Properties

    angle: Angle

    The vector's original angle. (This can be modified after Vector construction.)

    magnitude: number

    The vector's distance in its given angle. (This can be modified after Vector construction.)

    options: undefined | { digits: undefined | number }

    Vector options. Set to undefined to disable all options.

    Type declaration

    • undefined
    • { digits: undefined | number }
      • digits: undefined | number

        Number of digits to round all values to. Set to undefined to disable rounding.

    Methods

    • Create a new Vector instance from its X and Y components.

      Parameters

      • __namedParameters: Coords
      • options: undefined | { digits: undefined | number }
        • undefined
        • { digits: undefined | number }
          • digits: undefined | number

            Number of digits to round all values to. Set to undefined to disable rounding.

      Returns Vector

    • Create a new Vector instance by calculating the distance and angle between two points.

      Parameters

      • point1: Coords
      • point2: Coords
      • options: undefined | { digits: undefined | number }
        • undefined
        • { digits: undefined | number }
          • digits: undefined | number

            Number of digits to round all values to. Set to undefined to disable rounding.

      Returns Vector