.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the Vector3.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_Vector3: Vector3 ======= **Category:** Built-In Types Brief Description ----------------- Vector class, which performs basic 3D vector math operations. Member Functions ---------------- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`Vector3` **(** :ref:`float` x, :ref:`float` y, :ref:`float` z **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`abs` **(** **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`angle_to` **(** :ref:`Vector3` to **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`bounce` **(** :ref:`Vector3` n **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`ceil` **(** **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`cross` **(** :ref:`Vector3` b **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`cubic_interpolate` **(** :ref:`Vector3` b, :ref:`Vector3` pre_a, :ref:`Vector3` post_b, :ref:`float` t **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`distance_squared_to` **(** :ref:`Vector3` b **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`distance_to` **(** :ref:`Vector3` b **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`dot` **(** :ref:`Vector3` b **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`floor` **(** **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`inverse` **(** **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_normalized` **(** **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`length` **(** **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`length_squared` **(** **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`linear_interpolate` **(** :ref:`Vector3` b, :ref:`float` t **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`max_axis` **(** **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`min_axis` **(** **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`normalized` **(** **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Basis` | :ref:`outer` **(** :ref:`Vector3` b **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`reflect` **(** :ref:`Vector3` n **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`rotated` **(** :ref:`Vector3` axis, :ref:`float` phi **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`round` **(** **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`slerp` **(** :ref:`Vector3` b, :ref:`float` t **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`slide` **(** :ref:`Vector3` n **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`snapped` **(** :ref:`Vector3` by **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Basis` | :ref:`to_diagonal_matrix` **(** **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Member Variables ---------------- .. _class_Vector3_x: - :ref:`float` **x** - The vector's x component. .. _class_Vector3_y: - :ref:`float` **y** - The vector's y component. .. _class_Vector3_z: - :ref:`float` **z** - The vector's z component. Numeric Constants ----------------- - **AXIS_X** = **0** --- Enumerated value for the X axis. Returned by :ref:`max_axis` and :ref:`min_axis`. - **AXIS_Y** = **1** --- Enumerated value for the Y axis. - **AXIS_Z** = **2** --- Enumerated value for the Z axis. Description ----------- Vector3 is one of the core classes of the engine, and includes several built-in helper functions to perform basic vector math operations. Member Function Description --------------------------- .. _class_Vector3_Vector3: - :ref:`Vector3` **Vector3** **(** :ref:`float` x, :ref:`float` y, :ref:`float` z **)** Returns a Vector3 with the given components. .. _class_Vector3_abs: - :ref:`Vector3` **abs** **(** **)** Returns a new vector with all components in absolute values (i.e. positive). .. _class_Vector3_angle_to: - :ref:`float` **angle_to** **(** :ref:`Vector3` to **)** Returns the minimum angle to the given vector. .. _class_Vector3_bounce: - :ref:`Vector3` **bounce** **(** :ref:`Vector3` n **)** Returns the vector "bounced off" from a plane defined by the given normal. .. _class_Vector3_ceil: - :ref:`Vector3` **ceil** **(** **)** Returns a new vector with all components rounded up. .. _class_Vector3_cross: - :ref:`Vector3` **cross** **(** :ref:`Vector3` b **)** Returns the cross product with ``b``. .. _class_Vector3_cubic_interpolate: - :ref:`Vector3` **cubic_interpolate** **(** :ref:`Vector3` b, :ref:`Vector3` pre_a, :ref:`Vector3` post_b, :ref:`float` t **)** Performs a cubic interpolation between vectors ``pre_a``, ``a``, ``b``, ``post_b`` (``a`` is current), by the given amount (t). (t) should be a float of 0.0-1.0, a percentage of how far along the interpolation is. .. _class_Vector3_distance_squared_to: - :ref:`float` **distance_squared_to** **(** :ref:`Vector3` b **)** Returns the squared distance to ``b``. Prefer this function over :ref:`distance_to` if you need to sort vectors or need the squared distance for some formula. .. _class_Vector3_distance_to: - :ref:`float` **distance_to** **(** :ref:`Vector3` b **)** Returns the distance to ``b``. .. _class_Vector3_dot: - :ref:`float` **dot** **(** :ref:`Vector3` b **)** Returns the dot product with ``b``. .. _class_Vector3_floor: - :ref:`Vector3` **floor** **(** **)** Returns a new vector with all components rounded down. .. _class_Vector3_inverse: - :ref:`Vector3` **inverse** **(** **)** Returns the inverse of the vector. This is the same as ``Vector3( 1.0 / v.x, 1.0 / v.y, 1.0 / v.z )``. .. _class_Vector3_is_normalized: - :ref:`bool` **is_normalized** **(** **)** Returns ``true`` if the vector is normalized. .. _class_Vector3_length: - :ref:`float` **length** **(** **)** Returns the vector's length. .. _class_Vector3_length_squared: - :ref:`float` **length_squared** **(** **)** Returns the vector's length squared. Prefer this function over :ref:`length` if you need to sort vectors or need the squared length for some formula. .. _class_Vector3_linear_interpolate: - :ref:`Vector3` **linear_interpolate** **(** :ref:`Vector3` b, :ref:`float` t **)** Returns the result of the linear interpolation between this vector and ``b`` by amount ``t``. ``t`` is in the range of ``0.0 - 1.0``, a percentage of how far along the interpolation is. .. _class_Vector3_max_axis: - :ref:`int` **max_axis** **(** **)** Returns the axis of the vector's largest value. See ``AXIS_*`` constants. .. _class_Vector3_min_axis: - :ref:`int` **min_axis** **(** **)** Returns the axis of the vector's smallest value. See ``AXIS_*`` constants. .. _class_Vector3_normalized: - :ref:`Vector3` **normalized** **(** **)** Returns the vector scaled to unit length. Equivalent to ``v / v.length()``. .. _class_Vector3_outer: - :ref:`Basis` **outer** **(** :ref:`Vector3` b **)** Returns the outer product with ``b``. .. _class_Vector3_reflect: - :ref:`Vector3` **reflect** **(** :ref:`Vector3` n **)** Returns the vector reflected from a plane defined by the given normal. .. _class_Vector3_rotated: - :ref:`Vector3` **rotated** **(** :ref:`Vector3` axis, :ref:`float` phi **)** Rotates the vector around a given axis by ``phi`` radians. The axis must be a normalized vector. .. _class_Vector3_round: - :ref:`Vector3` **round** **(** **)** .. _class_Vector3_slerp: - :ref:`Vector3` **slerp** **(** :ref:`Vector3` b, :ref:`float` t **)** Returns the result of SLERP between this vector and "b", by amount "t". "t" should be a float of 0.0-1.0, a percentage of how far along the interpolation is. Both vectors need to be normalized. .. _class_Vector3_slide: - :ref:`Vector3` **slide** **(** :ref:`Vector3` n **)** Returns the component of the vector along a plane defined by the given normal. .. _class_Vector3_snapped: - :ref:`Vector3` **snapped** **(** :ref:`Vector3` by **)** Returns a copy of the vector, snapped to the lowest neared multiple. .. _class_Vector3_to_diagonal_matrix: - :ref:`Basis` **to_diagonal_matrix** **(** **)** Returns a diagonal matrix with the vector as main diagonal.