phaser - v3.90.0
    Preparing search index...

    A representation of a vector in 4D space.

    A four-component vector.

    Index

    Constructors

    • Parameters

      • Optionalx: number

        The x component.

      • Optionaly: number

        The y component.

      • Optionalz: number

        The z component.

      • Optionalw: number

        The w component.

      Returns Vector4

    Properties

    w: number

    The w component of this Vector.

    x: number

    The x component of this Vector.

    y: number

    The y component of this Vector.

    z: number

    The z component of this Vector.

    Methods

    • Make a clone of this Vector4.

      Returns Vector4

    • Copy the components of a given Vector into this Vector.

      Parameters

      • src: Vector4

        The Vector to copy the components from.

      Returns Vector4

    • Calculate the dot product of this Vector and the given Vector.

      Parameters

      • v: Vector4

        The Vector4 to dot product with this Vector4.

      Returns number

    • Check whether this Vector is equal to a given Vector.

      Performs a strict quality check against each Vector's components.

      Parameters

      • v: Vector4

        The vector to check equality with.

      Returns boolean

    • Calculate the length (or magnitude) of this Vector.

      Returns number

    • Calculate the length of this Vector squared.

      Returns number

    • Linearly interpolate between this Vector and the given Vector.

      Interpolates this Vector towards the given Vector.

      Parameters

      • v: Vector4

        The Vector4 to interpolate towards.

      • Optionalt: number

        The interpolation percentage, between 0 and 1. Default 0.

      Returns Vector4

    • Negate the x, y, z and w components of this Vector.

      Returns Vector4

    • Normalize this Vector.

      Makes the vector a unit length vector (magnitude of 1) in the same direction.

      Returns Vector4

    • Make this Vector the zero vector (0, 0, 0, 0).

      Returns Vector4

    • Scale this Vector by the given value.

      Parameters

      • scale: number

        The value to scale this Vector by.

      Returns Vector4

    • Set the x, y, z and w components of the this Vector to the given x, y, z and w values.

      Parameters

      • x: number | object

        The x value to set for this Vector, or an object containing x, y, z and w components.

      • y: number

        The y value to set for this Vector.

      • z: number

        The z value to set for this Vector.

      • w: number

        The z value to set for this Vector.

      Returns Vector4

    • Transform this Vector with the given Matrix.

      Parameters

      • mat: Math.Matrix4

        The Matrix4 to transform this Vector4 with.

      Returns Vector4

    • Transform this Vector with the given Quaternion.

      Parameters

      • q: Quaternion

        The Quaternion to transform this Vector with.

      Returns Vector4