phaser - v4.0.0-rc.4
    Preparing search index...

    A representation of a vector in 3D space.

    A three-component vector.

    Index

    Constructors

    • Parameters

      • Optionalx: number

        The x component.

      • Optionaly: number

        The y component.

      • Optionalz: number

        The z component.

      Returns Math.Vector3

    Properties

    x: number

    The x component of this Vector.

    y: number

    The y component of this Vector.

    z: number

    The z component of this Vector.

    A static back Vector3 for use by reference.

    This constant is meant for comparison operations and should not be modified directly.

    A static down Vector3 for use by reference.

    This constant is meant for comparison operations and should not be modified directly.

    FORWARD: Math.Vector3

    A static forward Vector3 for use by reference.

    This constant is meant for comparison operations and should not be modified directly.

    A static left Vector3 for use by reference.

    This constant is meant for comparison operations and should not be modified directly.

    A static one Vector3 for use by reference.

    This constant is meant for comparison operations and should not be modified directly.

    RIGHT: Math.Vector3

    A static right Vector3 for use by reference.

    This constant is meant for comparison operations and should not be modified directly.

    A static up Vector3 for use by reference.

    This constant is meant for comparison operations and should not be modified directly.

    A static zero Vector3 for use by reference.

    This constant is meant for comparison operations and should not be modified directly.

    Methods

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

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

      Parameters

      Returns boolean

    • Sets the components of this Vector3 from the given array, based on the offset.

      Vector3.x = array[offset] Vector3.y = array[offset + 1] Vector3.z = array[offset + 2]

      Parameters

      • array: number[]

        The array of values to get this Vector from.

      • Optionaloffset: number

        The offset index into the array. Default 0.

      Returns Math.Vector3

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

      Returns number

    • Linearly interpolate between this Vector and the given Vector.

      Interpolates this Vector towards the given Vector.

      Parameters

      • v: Math.Vector3

        The Vector3 to interpolate towards.

      • Optionalt: number

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

      Returns Math.Vector3

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

      Parameters

      • x: number | object

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

      • Optionaly: number

        The y value to set for this Vector.

      • Optionalz: number

        The z value to set for this Vector.

      Returns Math.Vector3

    • Unproject this point from 2D space to 3D space. The point should have its x and y properties set to 2D screen space, and the z either at 0 (near plane) or 1 (far plane). The provided matrix is assumed to already be combined, i.e. projection * view * model.

      After this operation, this vector's (x, y, z) components will represent the unprojected 3D coordinate.

      Parameters

      • viewport: Vector4

        Screen x, y, width and height in pixels.

      • invProjectionView: Math.Matrix4

        Combined projection and view matrix.

      Returns Math.Vector3