PokéRogue
    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 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.

    BACK: Vector3

    A static back Vector3 for use by reference.

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

    DOWN: Vector3

    A static down Vector3 for use by reference.

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

    FORWARD: Vector3

    A static forward Vector3 for use by reference.

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

    LEFT: Vector3

    A static left Vector3 for use by reference.

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

    ONE: Vector3

    A static one Vector3 for use by reference.

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

    RIGHT: 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.

    ZERO: Vector3

    A static zero Vector3 for use by reference.

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

    Methods

    • Add a given Vector to this Vector. Addition is component-wise.

      Parameters

      Returns Vector3

    • Add the given value to each component of this Vector.

      Parameters

      • s: number

        The amount to add to this Vector.

      Returns Vector3

    • Add and scale a given Vector to this Vector. Addition is component-wise.

      Parameters

      • v: Vector2 | Vector3

        The Vector to add to this Vector.

      • scale: number

        The amount to scale v by.

      Returns Vector3

    • Adds the two given Vector3s and sets the results into this Vector3.

      Parameters

      • a: Vector3

        The first Vector to add.

      • b: Vector3

        The second Vector to add.

      Returns Vector3

    • Takes a Matrix3 and applies it to this Vector3.

      Parameters

      • mat3: Matrix3

        The Matrix3 to apply to this Vector3.

      Returns Vector3

    • Takes a Matrix4 and applies it to this Vector3.

      Parameters

      • mat4: Matrix4

        The Matrix4 to apply to this Vector3.

      Returns Vector3

    • Make a clone of this Vector3.

      Returns Vector3

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

      Parameters

      Returns Vector3

    • Calculate the cross (vector) product of this Vector (which will be modified) and the given Vector.

      Parameters

      • v: Vector3

        The Vector to cross product with.

      Returns Vector3

    • Calculate the cross (vector) product of two given Vectors.

      Parameters

      • a: Vector3

        The first Vector to multiply.

      • b: Vector3

        The second Vector to multiply.

      Returns Vector3

    • Calculate the distance between this Vector and the given Vector.

      Parameters

      Returns number

    • Calculate the distance between this Vector and the given Vector, squared.

      Parameters

      Returns number

    • Perform a component-wise division between this Vector and the given Vector.

      Divides this Vector by the given Vector.

      Parameters

      Returns Vector3

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

      Parameters

      • v: Vector3

        The Vector3 to dot product with this Vector3.

      Returns number

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

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

      Parameters

      • v: Vector3

        The Vector3 to compare against.

      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 Vector3

    • 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: Vector3

        The Vector3 to interpolate towards.

      • Optionalt: number

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

      Returns Vector3

    • Sets the components of this Vector to be the Math.max result from the given vector.

      Parameters

      • v: Vector3

        The Vector3 to check the maximum values against.

      Returns Vector3

    • Sets the components of this Vector to be the Math.min result from the given vector.

      Parameters

      • v: Vector3

        The Vector3 to check the minimum values against.

      Returns Vector3

    • Perform a component-wise multiplication between this Vector and the given Vector.

      Multiplies this Vector by the given Vector.

      Parameters

      Returns Vector3

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

      Returns Vector3

    • Normalize this Vector.

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

      Returns Vector3

    • Multiplies this Vector3 by the specified matrix, applying a W divide. This is useful for projection, e.g. unprojecting a 2D point into 3D space.

      Parameters

      • mat: Matrix4

        The Matrix4 to multiply this Vector3 with.

      Returns Vector3

    • Multiplies this Vector3 by the given view and projection matrices.

      Parameters

      • viewMatrix: Matrix4

        A View Matrix.

      • projectionMatrix: Matrix4

        A Projection Matrix.

      Returns Vector3

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

      Returns Vector3

    • Scale this Vector by the given value.

      Parameters

      • scale: number

        The value to scale this Vector by.

      Returns 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 Vector3

    • Sets the components of this Vector3 from the Matrix4 column specified.

      Parameters

      • mat4: Matrix4

        The Matrix4 to get the column from.

      • index: number

        The column index.

      Returns Vector3

    • Sets the components of this Vector3 from the position of the given Matrix4.

      Parameters

      • mat4: Matrix4

        The Matrix4 to get the position from.

      Returns Vector3

    • Subtract the given Vector from this Vector. Subtraction is component-wise.

      Parameters

      Returns Vector3

    • Subtracts the two given Vector3s and sets the results into this Vector3.

      Parameters

      • a: Vector3

        The first Vector to sub.

      • b: Vector3

        The second Vector to sub.

      Returns Vector3

    • Transforms the coordinates of this Vector3 with the given Matrix4.

      Parameters

      • mat: Matrix4

        The Matrix4 to transform this Vector3 with.

      Returns Vector3

    • Transform this Vector with the given Matrix.

      Parameters

      • mat: Matrix3

        The Matrix3 to transform this Vector3 with.

      Returns Vector3

    • Transform this Vector with the given Matrix4.

      Parameters

      • mat: Matrix4

        The Matrix4 to transform this Vector3 with.

      Returns Vector3

    • Transform this Vector with the given Quaternion.

      Parameters

      • q: Quaternion

        The Quaternion to transform this Vector with.

      Returns 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: Matrix4

        Combined projection and view matrix.

      Returns Vector3

    • Multiplies this Vector3 by the given inversed projection matrix and world matrix.

      Parameters

      • projectionMatrix: Matrix4

        An inversed Projection Matrix.

      • worldMatrix: Matrix4

        A World View Matrix.

      Returns Vector3

    • Set this Vector to point up.

      Sets the y component of the vector to 1, and the others to 0.

      Returns Vector3