phaser - v3.90.0
    Preparing search index...

    A quaternion.

    Index

    Constructors

    • Parameters

      • Optionalx: number

        The x component. Default 0.

      • Optionaly: number

        The y component. Default 0.

      • Optionalz: number

        The z component. Default 0.

      • Optionalw: number

        The w component. Default 1.

      Returns Quaternion

    Properties

    onChangeCallback: Function

    This callback is invoked, if set, each time a value in this quaternion is changed. The callback is passed one argument, a reference to this quaternion.

    w: number

    The w component of this Quaternion.

    x: number

    The x component of this Quaternion.

    y: number

    The y component of this Quaternion.

    z: number

    The z component of this Quaternion.

    Methods

    • Create a unit (or rotation) Quaternion from its x, y, and z components.

      Sets the w component.

      Returns Quaternion

    • Convert this Quaternion into its conjugate.

      Sets the x, y and z components.

      Returns Quaternion

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

      Parameters

      • v: Vector4 | Quaternion

        The Quaternion or Vector to dot product with this Quaternion.

      Returns number

    • Convert the given Matrix into this Quaternion.

      Parameters

      • mat: Matrix3

        The Matrix to convert from.

      Returns Quaternion

    • Reset this Matrix to an identity (default) Quaternion.

      Returns Quaternion

    • Calculate the length of this Quaternion.

      Returns number

    • Calculate the length of this Quaternion squared.

      Returns number

    • Linearly interpolate this Quaternion towards the given Quaternion or Vector.

      Parameters

      • v: Vector4 | Quaternion

        The Quaternion or Vector to interpolate towards.

      • Optionalt: number

        The percentage of interpolation. Default 0.

      Returns Quaternion

    • Normalize this Quaternion.

      Returns Quaternion

    • Rotate this Quaternion on the X axis.

      Parameters

      • rad: number

        The rotation angle in radians.

      Returns Quaternion

    • Rotate this Quaternion on the Y axis.

      Parameters

      • rad: number

        The rotation angle in radians.

      Returns Quaternion

    • Rotate this Quaternion on the Z axis.

      Parameters

      • rad: number

        The rotation angle in radians.

      Returns Quaternion

    • Scale this Quaternion by the given value.

      Parameters

      • scale: number

        The value to scale this Quaternion by.

      Returns Quaternion

    • Set the components of this Quaternion and optionally call the onChangeCallback.

      Parameters

      • Optionalx: number | object

        The x component, or an object containing x, y, z, and w components. Default 0.

      • Optionaly: number

        The y component. Default 0.

      • Optionalz: number

        The z component. Default 0.

      • Optionalw: number

        The w component. Default 0.

      • Optionalupdate: boolean

        Call the onChangeCallback? Default true.

      Returns Quaternion

    • Set the axis angle of this Quaternion.

      Parameters

      • axis: Math.Vector3

        The axis.

      • rad: number

        The angle in radians.

      Returns Quaternion

    • Set this Quaternion from the given Euler, based on Euler order.

      Parameters

      • euler: Euler

        The Euler to convert from.

      • Optionalupdate: boolean

        Run the onChangeCallback? Default true.

      Returns Quaternion

    • Sets the rotation of this Quaternion from the given Matrix4.

      Parameters

      • mat4: Math.Matrix4

        The Matrix4 to set the rotation from.

      Returns Quaternion

    • Smoothly linearly interpolate this Quaternion towards the given Quaternion or Vector.

      Parameters

      • b: Vector4 | Quaternion

        The Quaternion or Vector to interpolate towards.

      • t: number

        The percentage of interpolation.

      Returns Quaternion

    • Subtract a given Quaternion or Vector from this Quaternion. Subtraction is component-wise.

      Parameters

      Returns Quaternion