phaser - v3.90.0
    Preparing search index...

    The Matter.Vector module contains methods for creating and manipulating vectors. Vectors are the basis of all the geometry related operations in the engine. A Matter.Vector object is of the form { x: 0, y: 0 }.

    See the included usage examples.

    Vector

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    x: number
    y: number

    Methods

    • Returns the angle in radians between the two vectors relative to the x-axis.

      Parameters

      Returns number

      The angle in radians

      angle

    • Creates a new vector.

      Parameters

      • Optionalx: number
      • Optionaly: number

      Returns MatterJS.Vector

      A new vector

      create

    • Returns the magnitude (length) of a vector.

      Parameters

      Returns number

      The magnitude of the vector

      magnitude

    • Returns the magnitude (length) of a vector (therefore saving a sqrt operation).

      Parameters

      Returns number

      The squared magnitude of the vector

      magnitudeSquared

    • Returns the perpendicular vector. Set negate to true for the perpendicular in the opposite direction.

      Parameters

      Returns MatterJS.Vector

      The perpendicular vector

      perp