classref: Sync with current master branch (96cdbbe)

This commit is contained in:
Godot Organization
2025-02-15 03:21:09 +00:00
parent 4f3c3fc101
commit b55955c3ce
427 changed files with 4074 additions and 3919 deletions

View File

@@ -247,7 +247,7 @@ enum **Axis**: :ref:`🔗<enum_Vector2_Axis>`
:ref:`Axis<enum_Vector2_Axis>` **AXIS_X** = ``0``
Enumerated value for the X axis. Returned by :ref:`max_axis_index<class_Vector2_method_max_axis_index>` and :ref:`min_axis_index<class_Vector2_method_min_axis_index>`.
Enumerated value for the X axis. Returned by :ref:`max_axis_index()<class_Vector2_method_max_axis_index>` and :ref:`min_axis_index()<class_Vector2_method_min_axis_index>`.
.. _class_Vector2_constant_AXIS_Y:
@@ -255,7 +255,7 @@ Enumerated value for the X axis. Returned by :ref:`max_axis_index<class_Vector2_
:ref:`Axis<enum_Vector2_Axis>` **AXIS_Y** = ``1``
Enumerated value for the Y axis. Returned by :ref:`max_axis_index<class_Vector2_method_max_axis_index>` and :ref:`min_axis_index<class_Vector2_method_min_axis_index>`.
Enumerated value for the Y axis. Returned by :ref:`max_axis_index()<class_Vector2_method_max_axis_index>` and :ref:`min_axis_index()<class_Vector2_method_min_axis_index>`.
.. rst-class:: classref-section-separator
@@ -431,7 +431,7 @@ For example, ``Vector2.RIGHT.angle()`` will return zero, ``Vector2.DOWN.angle()`
\ `Illustration of the returned angle. <https://raw.githubusercontent.com/godotengine/godot-docs/master/img/vector2_angle.png>`__\
Equivalent to the result of :ref:`@GlobalScope.atan2<class_@GlobalScope_method_atan2>` when called with the vector's :ref:`y<class_Vector2_property_y>` and :ref:`x<class_Vector2_property_x>` as parameters: ``atan2(y, x)``.
Equivalent to the result of :ref:`@GlobalScope.atan2()<class_@GlobalScope_method_atan2>` when called with the vector's :ref:`y<class_Vector2_property_y>` and :ref:`x<class_Vector2_property_x>` as parameters: ``atan2(y, x)``.
.. rst-class:: classref-item-separator
@@ -443,7 +443,7 @@ Equivalent to the result of :ref:`@GlobalScope.atan2<class_@GlobalScope_method_a
:ref:`float<class_float>` **angle_to**\ (\ to\: :ref:`Vector2<class_Vector2>`\ ) |const| :ref:`🔗<class_Vector2_method_angle_to>`
Returns the angle to the given vector, in radians.
Returns the signed angle to the given vector, in radians.
\ `Illustration of the returned angle. <https://raw.githubusercontent.com/godotengine/godot-docs/master/img/vector2_angle_to.png>`__
@@ -511,7 +511,7 @@ Returns the point at the given ``t`` on the `Bézier curve <https://en.wikipedia
Returns the vector "bounced off" from a line defined by the given normal ``n`` perpendicular to the line.
\ **Note:** :ref:`bounce<class_Vector2_method_bounce>` performs the operation that most engines and frameworks call ``reflect()``.
\ **Note:** :ref:`bounce()<class_Vector2_method_bounce>` performs the operation that most engines and frameworks call ``reflect()``.
.. rst-class:: classref-item-separator
@@ -535,7 +535,7 @@ Returns a new vector with all components rounded up (towards positive infinity).
:ref:`Vector2<class_Vector2>` **clamp**\ (\ min\: :ref:`Vector2<class_Vector2>`, max\: :ref:`Vector2<class_Vector2>`\ ) |const| :ref:`🔗<class_Vector2_method_clamp>`
Returns a new vector with all components clamped between the components of ``min`` and ``max``, by running :ref:`@GlobalScope.clamp<class_@GlobalScope_method_clamp>` on each component.
Returns a new vector with all components clamped between the components of ``min`` and ``max``, by running :ref:`@GlobalScope.clamp()<class_@GlobalScope_method_clamp>` on each component.
.. rst-class:: classref-item-separator
@@ -547,7 +547,7 @@ Returns a new vector with all components clamped between the components of ``min
:ref:`Vector2<class_Vector2>` **clampf**\ (\ min\: :ref:`float<class_float>`, max\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Vector2_method_clampf>`
Returns a new vector with all components clamped between ``min`` and ``max``, by running :ref:`@GlobalScope.clamp<class_@GlobalScope_method_clamp>` on each component.
Returns a new vector with all components clamped between ``min`` and ``max``, by running :ref:`@GlobalScope.clamp()<class_@GlobalScope_method_clamp>` on each component.
.. rst-class:: classref-item-separator
@@ -589,7 +589,7 @@ Performs a cubic interpolation between this vector and ``b`` using ``pre_a`` and
Performs a cubic interpolation between this vector and ``b`` using ``pre_a`` and ``post_b`` as handles, and returns the result at position ``weight``. ``weight`` is on the range of 0.0 to 1.0, representing the amount of interpolation.
It can perform smoother interpolation than :ref:`cubic_interpolate<class_Vector2_method_cubic_interpolate>` by the time values.
It can perform smoother interpolation than :ref:`cubic_interpolate()<class_Vector2_method_cubic_interpolate>` by the time values.
.. rst-class:: classref-item-separator
@@ -615,7 +615,7 @@ Returns the normalized vector pointing from this vector to ``to``. This is equiv
Returns the squared distance between this vector and ``to``.
This method runs faster than :ref:`distance_to<class_Vector2_method_distance_to>`, so prefer it if you need to compare vectors or need the squared distance for some formula.
This method runs faster than :ref:`distance_to()<class_Vector2_method_distance_to>`, so prefer it if you need to compare vectors or need the squared distance for some formula.
.. rst-class:: classref-item-separator
@@ -687,7 +687,7 @@ Creates a unit **Vector2** rotated to the given ``angle`` in radians. This is eq
:ref:`bool<class_bool>` **is_equal_approx**\ (\ to\: :ref:`Vector2<class_Vector2>`\ ) |const| :ref:`🔗<class_Vector2_method_is_equal_approx>`
Returns ``true`` if this vector and ``to`` are approximately equal, by running :ref:`@GlobalScope.is_equal_approx<class_@GlobalScope_method_is_equal_approx>` on each component.
Returns ``true`` if this vector and ``to`` are approximately equal, by running :ref:`@GlobalScope.is_equal_approx()<class_@GlobalScope_method_is_equal_approx>` on each component.
.. rst-class:: classref-item-separator
@@ -699,7 +699,7 @@ Returns ``true`` if this vector and ``to`` are approximately equal, by running :
:ref:`bool<class_bool>` **is_finite**\ (\ ) |const| :ref:`🔗<class_Vector2_method_is_finite>`
Returns ``true`` if this vector is finite, by calling :ref:`@GlobalScope.is_finite<class_@GlobalScope_method_is_finite>` on each component.
Returns ``true`` if this vector is finite, by calling :ref:`@GlobalScope.is_finite()<class_@GlobalScope_method_is_finite>` on each component.
.. rst-class:: classref-item-separator
@@ -723,9 +723,9 @@ Returns ``true`` if the vector is normalized, i.e. its length is approximately e
:ref:`bool<class_bool>` **is_zero_approx**\ (\ ) |const| :ref:`🔗<class_Vector2_method_is_zero_approx>`
Returns ``true`` if this vector's values are approximately zero, by running :ref:`@GlobalScope.is_zero_approx<class_@GlobalScope_method_is_zero_approx>` on each component.
Returns ``true`` if this vector's values are approximately zero, by running :ref:`@GlobalScope.is_zero_approx()<class_@GlobalScope_method_is_zero_approx>` on each component.
This method is faster than using :ref:`is_equal_approx<class_Vector2_method_is_equal_approx>` with one value as a zero vector.
This method is faster than using :ref:`is_equal_approx()<class_Vector2_method_is_equal_approx>` with one value as a zero vector.
.. rst-class:: classref-item-separator
@@ -751,7 +751,7 @@ Returns the length (magnitude) of this vector.
Returns the squared length (squared magnitude) of this vector.
This method runs faster than :ref:`length<class_Vector2_method_length>`, so prefer it if you need to compare vectors or need the squared distance for some formula.
This method runs faster than :ref:`length()<class_Vector2_method_length>`, so prefer it if you need to compare vectors or need the squared distance for some formula.
.. rst-class:: classref-item-separator
@@ -871,7 +871,7 @@ Returns a new vector moved toward ``to`` by the fixed ``delta`` amount. Will not
:ref:`Vector2<class_Vector2>` **normalized**\ (\ ) |const| :ref:`🔗<class_Vector2_method_normalized>`
Returns the result of scaling the vector to unit length. Equivalent to ``v / v.length()``. Returns ``(0, 0)`` if ``v.length() == 0``. See also :ref:`is_normalized<class_Vector2_method_is_normalized>`.
Returns the result of scaling the vector to unit length. Equivalent to ``v / v.length()``. Returns ``(0, 0)`` if ``v.length() == 0``. See also :ref:`is_normalized()<class_Vector2_method_is_normalized>`.
\ **Note:** This function may return incorrect values if the input vector length is near zero.
@@ -897,7 +897,7 @@ Returns a perpendicular vector rotated 90 degrees counter-clockwise compared to
:ref:`Vector2<class_Vector2>` **posmod**\ (\ mod\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Vector2_method_posmod>`
Returns a vector composed of the :ref:`@GlobalScope.fposmod<class_@GlobalScope_method_fposmod>` of this vector's components and ``mod``.
Returns a vector composed of the :ref:`@GlobalScope.fposmod()<class_@GlobalScope_method_fposmod>` of this vector's components and ``mod``.
.. rst-class:: classref-item-separator
@@ -909,7 +909,7 @@ Returns a vector composed of the :ref:`@GlobalScope.fposmod<class_@GlobalScope_m
:ref:`Vector2<class_Vector2>` **posmodv**\ (\ modv\: :ref:`Vector2<class_Vector2>`\ ) |const| :ref:`🔗<class_Vector2_method_posmodv>`
Returns a vector composed of the :ref:`@GlobalScope.fposmod<class_@GlobalScope_method_fposmod>` of this vector's components and ``modv``'s components.
Returns a vector composed of the :ref:`@GlobalScope.fposmod()<class_@GlobalScope_method_fposmod>` of this vector's components and ``modv``'s components.
.. rst-class:: classref-item-separator
@@ -921,7 +921,7 @@ Returns a vector composed of the :ref:`@GlobalScope.fposmod<class_@GlobalScope_m
:ref:`Vector2<class_Vector2>` **project**\ (\ b\: :ref:`Vector2<class_Vector2>`\ ) |const| :ref:`🔗<class_Vector2_method_project>`
Returns a new vector resulting from projecting this vector onto the given vector ``b``. The resulting new vector is parallel to ``b``. See also :ref:`slide<class_Vector2_method_slide>`.
Returns a new vector resulting from projecting this vector onto the given vector ``b``. The resulting new vector is parallel to ``b``. See also :ref:`slide()<class_Vector2_method_slide>`.
\ **Note:** If the vector ``b`` is a zero vector, the components of the resulting new vector will be :ref:`@GDScript.NAN<class_@GDScript_constant_NAN>`.
@@ -937,7 +937,7 @@ Returns a new vector resulting from projecting this vector onto the given vector
Returns the result of reflecting the vector from a line defined by the given direction vector ``line``.
\ **Note:** :ref:`reflect<class_Vector2_method_reflect>` differs from what other engines and frameworks call ``reflect()``. In other engines, ``reflect()`` takes a normal direction which is a direction perpendicular to the line. In Godot, you specify the direction of the line directly. See also :ref:`bounce<class_Vector2_method_bounce>` which does what most engines call ``reflect()``.
\ **Note:** :ref:`reflect()<class_Vector2_method_reflect>` differs from what other engines and frameworks call ``reflect()``. In other engines, ``reflect()`` takes a normal direction which is a direction perpendicular to the line. In Godot, you specify the direction of the line directly. See also :ref:`bounce()<class_Vector2_method_bounce>` which does what most engines call ``reflect()``.
.. rst-class:: classref-item-separator
@@ -949,7 +949,7 @@ Returns the result of reflecting the vector from a line defined by the given dir
:ref:`Vector2<class_Vector2>` **rotated**\ (\ angle\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Vector2_method_rotated>`
Returns the result of rotating this vector by ``angle`` (in radians). See also :ref:`@GlobalScope.deg_to_rad<class_@GlobalScope_method_deg_to_rad>`.
Returns the result of rotating this vector by ``angle`` (in radians). See also :ref:`@GlobalScope.deg_to_rad()<class_@GlobalScope_method_deg_to_rad>`.
.. rst-class:: classref-item-separator
@@ -973,7 +973,7 @@ Returns a new vector with all components rounded to the nearest integer, with ha
:ref:`Vector2<class_Vector2>` **sign**\ (\ ) |const| :ref:`🔗<class_Vector2_method_sign>`
Returns a new vector with each component set to ``1.0`` if it's positive, ``-1.0`` if it's negative, and ``0.0`` if it's zero. The result is identical to calling :ref:`@GlobalScope.sign<class_@GlobalScope_method_sign>` on each component.
Returns a new vector with each component set to ``1.0`` if it's positive, ``-1.0`` if it's negative, and ``0.0`` if it's zero. The result is identical to calling :ref:`@GlobalScope.sign()<class_@GlobalScope_method_sign>` on each component.
.. rst-class:: classref-item-separator
@@ -987,7 +987,7 @@ Returns a new vector with each component set to ``1.0`` if it's positive, ``-1.0
Returns the result of spherical linear interpolation between this vector and ``to``, by amount ``weight``. ``weight`` is on the range of 0.0 to 1.0, representing the amount of interpolation.
This method also handles interpolating the lengths if the input vectors have different lengths. For the special case of one or both input vectors having zero length, this method behaves like :ref:`lerp<class_Vector2_method_lerp>`.
This method also handles interpolating the lengths if the input vectors have different lengths. For the special case of one or both input vectors having zero length, this method behaves like :ref:`lerp()<class_Vector2_method_lerp>`.
.. rst-class:: classref-item-separator
@@ -999,9 +999,9 @@ This method also handles interpolating the lengths if the input vectors have dif
:ref:`Vector2<class_Vector2>` **slide**\ (\ n\: :ref:`Vector2<class_Vector2>`\ ) |const| :ref:`🔗<class_Vector2_method_slide>`
Returns a new vector resulting from sliding this vector along a line with normal ``n``. The resulting new vector is perpendicular to ``n``, and is equivalent to this vector minus its projection on ``n``. See also :ref:`project<class_Vector2_method_project>`.
Returns a new vector resulting from sliding this vector along a line with normal ``n``. The resulting new vector is perpendicular to ``n``, and is equivalent to this vector minus its projection on ``n``. See also :ref:`project()<class_Vector2_method_project>`.
\ **Note:** The vector ``n`` must be normalized. See also :ref:`normalized<class_Vector2_method_normalized>`.
\ **Note:** The vector ``n`` must be normalized. See also :ref:`normalized()<class_Vector2_method_normalized>`.
.. rst-class:: classref-item-separator
@@ -1044,7 +1044,7 @@ Operator Descriptions
Returns ``true`` if the vectors are not equal.
\ **Note:** Due to floating-point precision errors, consider using :ref:`is_equal_approx<class_Vector2_method_is_equal_approx>` instead, which is more reliable.
\ **Note:** Due to floating-point precision errors, consider using :ref:`is_equal_approx()<class_Vector2_method_is_equal_approx>` instead, which is more reliable.
\ **Note:** Vectors with :ref:`@GDScript.NAN<class_@GDScript_constant_NAN>` elements don't behave the same as other vectors. Therefore, the results from this operator may not be accurate if NaNs are included.
@@ -1060,9 +1060,9 @@ Returns ``true`` if the vectors are not equal.
Inversely transforms (multiplies) the **Vector2** by the given :ref:`Transform2D<class_Transform2D>` transformation matrix, under the assumption that the transformation basis is orthonormal (i.e. rotation/reflection is fine, scaling/skew is not).
\ ``vector * transform`` is equivalent to ``transform.inverse() * vector``. See :ref:`Transform2D.inverse<class_Transform2D_method_inverse>`.
\ ``vector * transform`` is equivalent to ``transform.inverse() * vector``. See :ref:`Transform2D.inverse()<class_Transform2D_method_inverse>`.
For transforming by inverse of an affine transformation (e.g. with scaling) ``transform.affine_inverse() * vector`` can be used instead. See :ref:`Transform2D.affine_inverse<class_Transform2D_method_affine_inverse>`.
For transforming by inverse of an affine transformation (e.g. with scaling) ``transform.affine_inverse() * vector`` can be used instead. See :ref:`Transform2D.affine_inverse()<class_Transform2D_method_affine_inverse>`.
.. rst-class:: classref-item-separator
@@ -1216,7 +1216,7 @@ Compares two **Vector2** vectors by first checking if the X value of the left ve
Returns ``true`` if the vectors are exactly equal.
\ **Note:** Due to floating-point precision errors, consider using :ref:`is_equal_approx<class_Vector2_method_is_equal_approx>` instead, which is more reliable.
\ **Note:** Due to floating-point precision errors, consider using :ref:`is_equal_approx()<class_Vector2_method_is_equal_approx>` instead, which is more reliable.
\ **Note:** Vectors with :ref:`@GDScript.NAN<class_@GDScript_constant_NAN>` elements don't behave the same as other vectors. Therefore, the results from this operator may not be accurate if NaNs are included.