[3.2] Backport core documentation changes to 3.2
Also add AABB.abs()
This commit is contained in:
parent
af35d0d3c8
commit
3ab5183ffa
|
@ -101,6 +101,10 @@ public:
|
|||
_FORCE_INLINE_ void project_range_in_plane(const Plane &p_plane, real_t &r_min, real_t &r_max) const;
|
||||
_FORCE_INLINE_ void expand_to(const Vector3 &p_vector); /** expand to contain a point if necessary */
|
||||
|
||||
_FORCE_INLINE_ AABB abs() const {
|
||||
return AABB(Vector3(position.x + MIN(size.x, 0), position.y + MIN(size.y, 0), position.z + MIN(size.z, 0)), size.abs());
|
||||
}
|
||||
|
||||
operator String() const;
|
||||
|
||||
_FORCE_INLINE_ AABB() {}
|
||||
|
|
|
@ -56,7 +56,6 @@ Plane Plane::normalized() const {
|
|||
}
|
||||
|
||||
Vector3 Plane::get_any_point() const {
|
||||
|
||||
return get_normal() * d;
|
||||
}
|
||||
|
||||
|
|
|
@ -743,6 +743,7 @@ struct _VariantCall {
|
|||
#define VCALL_PTR5R(m_type, m_method) \
|
||||
static void _call_##m_type##_##m_method(Variant &r_ret, Variant &p_self, const Variant **p_args) { r_ret = reinterpret_cast<m_type *>(p_self._data._ptr)->m_method(*p_args[0], *p_args[1], *p_args[2], *p_args[3], *p_args[4]); }
|
||||
|
||||
VCALL_PTR0R(AABB, abs);
|
||||
VCALL_PTR0R(AABB, get_area);
|
||||
VCALL_PTR0R(AABB, has_no_area);
|
||||
VCALL_PTR0R(AABB, has_no_surface);
|
||||
|
@ -1909,6 +1910,7 @@ void register_variant_methods() {
|
|||
|
||||
//pointerbased
|
||||
|
||||
ADDFUNC0R(AABB, AABB, AABB, abs, varray());
|
||||
ADDFUNC0R(AABB, REAL, AABB, get_area, varray());
|
||||
ADDFUNC0R(AABB, BOOL, AABB, has_no_area, varray());
|
||||
ADDFUNC0R(AABB, BOOL, AABB, has_no_surface, varray());
|
||||
|
|
|
@ -18,7 +18,14 @@
|
|||
<argument index="1" name="size" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Optional constructor, accepts position and size.
|
||||
Constructs an [AABB] from a position and size.
|
||||
</description>
|
||||
</method>
|
||||
<method name="abs">
|
||||
<return type="AABB">
|
||||
</return>
|
||||
<description>
|
||||
Returns an AABB with equivalent position and size, modified so that the most-negative corner is the origin and the size is positive.
|
||||
</description>
|
||||
</method>
|
||||
<method name="encloses">
|
||||
|
@ -197,13 +204,14 @@
|
|||
</methods>
|
||||
<members>
|
||||
<member name="end" type="Vector3" setter="" getter="" default="Vector3( 0, 0, 0 )">
|
||||
Ending corner. This is calculated as [code]position + size[/code]. Changing this property changes [member size] accordingly.
|
||||
Ending corner. This is calculated as [code]position + size[/code]. Setting this value will change the size.
|
||||
</member>
|
||||
<member name="position" type="Vector3" setter="" getter="" default="Vector3( 0, 0, 0 )">
|
||||
Beginning corner.
|
||||
Beginning corner. Typically has values lower than [member end].
|
||||
</member>
|
||||
<member name="size" type="Vector3" setter="" getter="" default="Vector3( 0, 0, 0 )">
|
||||
Size from position to end.
|
||||
Size from [member position] to [member end]. Typically all components are positive.
|
||||
If the size is negative, you can use [method abs] to fix it.
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
|
|
|
@ -4,10 +4,13 @@
|
|||
3×3 matrix datatype.
|
||||
</brief_description>
|
||||
<description>
|
||||
3×3 matrix used for 3D rotation and scale. Contains 3 vector fields X, Y and Z as its columns, which can be interpreted as the local basis vectors of a transformation. Can also be accessed as array of 3D vectors. These vectors are orthogonal to each other, but are not necessarily normalized (due to scaling). Almost always used as an orthogonal basis for a [Transform].
|
||||
For such use, it is composed of a scaling and a rotation matrix, in that order (M = R.S).
|
||||
3×3 matrix used for 3D rotation and scale. Almost always used as an orthogonal basis for a Transform.
|
||||
Contains 3 vector fields X, Y and Z as its columns, which are typically interpreted as the local basis vectors of a transformation. For such use, it is composed of a scaling and a rotation matrix, in that order (M = R.S).
|
||||
Can also be accessed as array of 3D vectors. These vectors are normally orthogonal to each other, but are not necessarily normalized (due to scaling).
|
||||
For more information, read the "Matrices and transforms" documentation article.
|
||||
</description>
|
||||
<tutorials>
|
||||
<link>https://docs.godotengine.org/en/latest/tutorials/math/matrices_and_transforms.html</link>
|
||||
<link>https://docs.godotengine.org/en/latest/tutorials/3d/using_transforms.html</link>
|
||||
</tutorials>
|
||||
<methods>
|
||||
|
@ -17,7 +20,7 @@
|
|||
<argument index="0" name="from" type="Quat">
|
||||
</argument>
|
||||
<description>
|
||||
Create a rotation matrix from the given quaternion.
|
||||
Constructs a pure rotation basis matrix from the given quaternion.
|
||||
</description>
|
||||
</method>
|
||||
<method name="Basis">
|
||||
|
@ -26,7 +29,8 @@
|
|||
<argument index="0" name="from" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Create a rotation matrix (in the YXZ convention: first Z, then X, and Y last) from the specified Euler angles, given in the vector format as (X angle, Y angle, Z angle).
|
||||
Constructs a pure rotation basis matrix from the given Euler angles (in the YXZ convention: when *composing*, first Y, then X, and Z last), given in the vector format as (X angle, Y angle, Z angle).
|
||||
Consider using the [Quat] constructor instead, which uses a quaternion instead of Euler angles.
|
||||
</description>
|
||||
</method>
|
||||
<method name="Basis">
|
||||
|
@ -37,7 +41,7 @@
|
|||
<argument index="1" name="phi" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Create a rotation matrix which rotates around the given axis by the specified angle, in radians. The axis must be a normalized vector.
|
||||
Constructs a pure rotation basis matrix, rotated around the given [code]axis[/code] by [code]phi[/code], in radians. The axis must be a normalized vector.
|
||||
</description>
|
||||
</method>
|
||||
<method name="Basis">
|
||||
|
@ -50,28 +54,30 @@
|
|||
<argument index="2" name="z_axis" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Create a matrix from 3 axis vectors.
|
||||
Constructs a basis matrix from 3 axis vectors (matrix columns).
|
||||
</description>
|
||||
</method>
|
||||
<method name="determinant">
|
||||
<return type="float">
|
||||
</return>
|
||||
<description>
|
||||
Returns the determinant of the matrix.
|
||||
Returns the determinant of the basis matrix. If the basis is uniformly scaled, its determinant is the square of the scale.
|
||||
A negative determinant means the basis has a negative scale. A zero determinant means the basis isn't invertible, and is usually considered invalid.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_euler">
|
||||
<return type="Vector3">
|
||||
</return>
|
||||
<description>
|
||||
Returns the basis's rotation in the form of Euler angles (in the YXZ convention: first Z, then X, and Y last). The returned vector contains the rotation angles in the format (X angle, Y angle, Z angle). See [method get_rotation_quat] if you need a quaternion instead.
|
||||
Returns the basis's rotation in the form of Euler angles (in the YXZ convention: when decomposing, first Z, then X, and Y last). The returned vector contains the rotation angles in the format (X angle, Y angle, Z angle).
|
||||
Consider using the [method get_rotation_quat] method instead, which returns a [Quat] quaternion instead of Euler angles.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_orthogonal_index">
|
||||
<return type="int">
|
||||
</return>
|
||||
<description>
|
||||
This function considers a discretization of rotations into 24 points on unit sphere, lying along the vectors (x,y,z) with each component being either -1, 0, or 1, and returns the index of the point best representing the orientation of the object. It is mainly used by the grid map editor. For further details, refer to the Godot source code.
|
||||
This function considers a discretization of rotations into 24 points on unit sphere, lying along the vectors (x,y,z) with each component being either -1, 0, or 1, and returns the index of the point best representing the orientation of the object. It is mainly used by the [GridMap] editor. For further details, refer to the Godot source code.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_rotation_quat">
|
||||
|
@ -193,25 +199,26 @@
|
|||
<argument index="0" name="v" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Returns a vector transformed (multiplied) by the transposed matrix.
|
||||
Returns a vector transformed (multiplied) by the transposed basis matrix.
|
||||
[b]Note:[/b] This results in a multiplication by the inverse of the matrix only if it represents a rotation-reflection.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="x" type="Vector3" setter="" getter="" default="Vector3( 1, 0, 0 )">
|
||||
The basis matrix's X vector.
|
||||
The basis matrix's X vector (column 0). Equivalent to array index [code]0[/code].
|
||||
</member>
|
||||
<member name="y" type="Vector3" setter="" getter="" default="Vector3( 0, 1, 0 )">
|
||||
The basis matrix's Y vector.
|
||||
The basis matrix's Y vector (column 1). Equivalent to array index [code]1[/code].
|
||||
</member>
|
||||
<member name="z" type="Vector3" setter="" getter="" default="Vector3( 0, 0, 1 )">
|
||||
The basis matrix's Z vector.
|
||||
The basis matrix's Z vector (column 2). Equivalent to array index [code]2[/code].
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
<constant name="IDENTITY" value="Basis( 1, 0, 0, 0, 1, 0, 0, 0, 1 )">
|
||||
The identity basis. This is identical to calling [code]Basis()[/code] without any parameters. This constant can be used to make your code clearer.
|
||||
The identity basis, with no rotation or scaling applied.
|
||||
This is identical to calling [code]Basis()[/code] without any parameters. This constant can be used to make your code clearer, and for consistency with C#.
|
||||
</constant>
|
||||
<constant name="FLIP_X" value="Basis( -1, 0, 0, 0, 1, 0, 0, 0, 1 )">
|
||||
The basis that will flip something along the X axis when used in a transformation.
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="Color" version="3.2">
|
||||
<brief_description>
|
||||
Color in RGBA format with some support for ARGB format.
|
||||
Color in RGBA format using floats on the range of 0 to 1.
|
||||
</brief_description>
|
||||
<description>
|
||||
A color is represented by red, green, and blue [code](r, g, b)[/code] components. Additionally, [code]a[/code] represents the alpha component, often used for transparency. Values are in floating-point and usually range from 0 to 1. Some properties (such as [member CanvasItem.modulate]) may accept values greater than 1.
|
||||
A color represented by red, green, blue, and alpha (RGBA) components. The alpha component is often used for transparency. Values are in floating-point and usually range from 0 to 1. Some properties (such as CanvasItem.modulate) may accept values greater than 1 (overbright or HDR colors).
|
||||
You can also create a color from standardized color names by using [method @GDScript.ColorN] or directly using the color constants defined here. The standardized color set is based on the [url=https://en.wikipedia.org/wiki/X11_color_names]X11 color names[/url].
|
||||
If you want to supply values in a range of 0 to 255, you should use [method @GDScript.Color8].
|
||||
[b]Note:[/b] In a boolean context, a Color will evaluate to [code]false[/code] if it's equal to [code]Color(0, 0, 0, 1)[/code] (opaque black). Otherwise, a Color will always evaluate to [code]true[/code].
|
||||
|
@ -275,37 +275,37 @@
|
|||
</methods>
|
||||
<members>
|
||||
<member name="a" type="float" setter="" getter="" default="1.0">
|
||||
Alpha value (range 0 to 1).
|
||||
The color's alpha (transparency) component, typically on the range of 0 to 1.
|
||||
</member>
|
||||
<member name="a8" type="int" setter="" getter="" default="255">
|
||||
Alpha value (range 0 to 255).
|
||||
Wrapper for [member a] that uses the range 0 to 255 instead of 0 to 1.
|
||||
</member>
|
||||
<member name="b" type="float" setter="" getter="" default="0.0">
|
||||
Blue value (range 0 to 1).
|
||||
The color's blue component, typically on the range of 0 to 1.
|
||||
</member>
|
||||
<member name="b8" type="int" setter="" getter="" default="0">
|
||||
Blue value (range 0 to 255).
|
||||
Wrapper for [member b] that uses the range 0 to 255 instead of 0 to 1.
|
||||
</member>
|
||||
<member name="g" type="float" setter="" getter="" default="0.0">
|
||||
Green value (range 0 to 1).
|
||||
The color's green component, typically on the range of 0 to 1.
|
||||
</member>
|
||||
<member name="g8" type="int" setter="" getter="" default="0">
|
||||
Green value (range 0 to 255).
|
||||
Wrapper for [member g] that uses the range 0 to 255 instead of 0 to 1.
|
||||
</member>
|
||||
<member name="h" type="float" setter="" getter="" default="0.0">
|
||||
HSV hue value (range 0 to 1).
|
||||
The HSV hue of this color, on the range 0 to 1.
|
||||
</member>
|
||||
<member name="r" type="float" setter="" getter="" default="0.0">
|
||||
Red value (range 0 to 1).
|
||||
The color's red component, typically on the range of 0 to 1.
|
||||
</member>
|
||||
<member name="r8" type="int" setter="" getter="" default="0">
|
||||
Red value (range 0 to 255).
|
||||
Wrapper for [member r] that uses the range 0 to 255 instead of 0 to 1.
|
||||
</member>
|
||||
<member name="s" type="float" setter="" getter="" default="0.0">
|
||||
HSV saturation value (range 0 to 1).
|
||||
The HSV saturation of this color, on the range 0 to 1.
|
||||
</member>
|
||||
<member name="v" type="float" setter="" getter="" default="0.0">
|
||||
HSV value (range 0 to 1).
|
||||
The HSV value (brightness) of this color, on the range 0 to 1.
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
|
|
|
@ -69,7 +69,8 @@
|
|||
<return type="Vector3">
|
||||
</return>
|
||||
<description>
|
||||
Returns a point on the plane.
|
||||
Returns the center of the plane.
|
||||
This method is deprecated, please use [method center] instead.
|
||||
</description>
|
||||
</method>
|
||||
<method name="has_point">
|
||||
|
@ -80,7 +81,7 @@
|
|||
<argument index="1" name="epsilon" type="float" default="1e-05">
|
||||
</argument>
|
||||
<description>
|
||||
Returns [code]true[/code] if [code]point[/code] is inside the plane (by a very minimum [code]epsilon[/code] threshold).
|
||||
Returns [code]true[/code] if [code]point[/code] is inside the plane. Comparison uses a custom minimum [code]epsilon[/code] threshold.
|
||||
</description>
|
||||
</method>
|
||||
<method name="intersect_3">
|
||||
|
@ -147,36 +148,38 @@
|
|||
<argument index="0" name="point" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the orthogonal projection of point [code]p[/code] into a point in the plane.
|
||||
Returns the orthogonal projection of [code]point[/code] into a point in the plane.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="d" type="float" setter="" getter="" default="0.0">
|
||||
Distance from the origin to the plane, in the direction of [member normal].
|
||||
The distance from the origin to the plane, in the direction of [member normal]. This value is typically non-negative.
|
||||
In the scalar equation of the plane [code]ax + by + cz = d[/code], this is [code]d[/code], while the [code](a, b, c)[/code] coordinates are represented by the [member normal] property.
|
||||
</member>
|
||||
<member name="normal" type="Vector3" setter="" getter="" default="Vector3( 0, 0, 0 )">
|
||||
The normal of the plane. "Over" or "Above" the plane is considered the side of the plane towards where the normal is pointing.
|
||||
The normal of the plane, which must be normalized.
|
||||
In the scalar equation of the plane [code]ax + by + cz = d[/code], this is the vector [code](a, b, c)[/code], where [code]d[/code] is the [member d] property.
|
||||
</member>
|
||||
<member name="x" type="float" setter="" getter="" default="0.0">
|
||||
The [member normal]'s X component.
|
||||
The X component of the plane's [member normal] vector.
|
||||
</member>
|
||||
<member name="y" type="float" setter="" getter="" default="0.0">
|
||||
The [member normal]'s Y component.
|
||||
The Y component of the plane's [member normal] vector.
|
||||
</member>
|
||||
<member name="z" type="float" setter="" getter="" default="0.0">
|
||||
The [member normal]'s Z component.
|
||||
The Z component of the plane's [member normal] vector.
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
<constant name="PLANE_YZ" value="Plane( 1, 0, 0, 0 )">
|
||||
A plane that extends in the Y and Z axes.
|
||||
A plane that extends in the Y and Z axes (normal vector points +X).
|
||||
</constant>
|
||||
<constant name="PLANE_XZ" value="Plane( 0, 1, 0, 0 )">
|
||||
A plane that extends in the X and Z axes.
|
||||
A plane that extends in the X and Z axes (normal vector points +Y).
|
||||
</constant>
|
||||
<constant name="PLANE_XY" value="Plane( 0, 0, 1, 0 )">
|
||||
A plane that extends in the X and Y axes.
|
||||
A plane that extends in the X and Y axes (normal vector points +Z).
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
Quaternion.
|
||||
</brief_description>
|
||||
<description>
|
||||
A unit quaternion used for representing 3D rotations.
|
||||
It is similar to [Basis], which implements matrix representation of rotations, and can be parametrized using both an axis-angle pair or Euler angles. But due to its compactness and the way it is stored in memory, certain operations (obtaining axis-angle and performing SLERP, in particular) are more efficient and robust against floating-point errors.
|
||||
Quaternions need to be (re)normalized.
|
||||
A unit quaternion used for representing 3D rotations. Quaternions need to be normalized to be used for rotation.
|
||||
It is similar to Basis, which implements matrix representation of rotations, and can be parametrized using both an axis-angle pair or Euler angles. Basis stores rotation, scale, and shearing, while Quat only stores rotation.
|
||||
Due to its compactness and the way it is stored in memory, certain operations (obtaining axis-angle and performing SLERP, in particular) are more efficient and robust against floating-point errors.
|
||||
</description>
|
||||
<tutorials>
|
||||
<link>https://docs.godotengine.org/en/latest/tutorials/3d/using_transforms.html#interpolating-with-quaternions</link>
|
||||
|
@ -18,7 +18,7 @@
|
|||
<argument index="0" name="from" type="Basis">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the rotation matrix corresponding to the given quaternion.
|
||||
Constructs a quaternion from the given [Basis].
|
||||
</description>
|
||||
</method>
|
||||
<method name="Quat">
|
||||
|
@ -27,7 +27,7 @@
|
|||
<argument index="0" name="euler" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Returns a quaternion that will perform a rotation specified by Euler angles (in the YXZ convention: first Z, then X, and Y last), given in the vector format as (X angle, Y angle, Z angle).
|
||||
Constructs a quaternion that will perform a rotation specified by Euler angles (in the YXZ convention: when decomposing, first Z, then X, and Y last), given in the vector format as (X angle, Y angle, Z angle).
|
||||
</description>
|
||||
</method>
|
||||
<method name="Quat">
|
||||
|
@ -38,7 +38,7 @@
|
|||
<argument index="1" name="angle" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Returns a quaternion that will rotate around the given axis by the specified angle. The axis must be a normalized vector.
|
||||
Constructs a quaternion that will rotate around the given axis by the specified angle. The axis must be a normalized vector.
|
||||
</description>
|
||||
</method>
|
||||
<method name="Quat">
|
||||
|
@ -53,7 +53,7 @@
|
|||
<argument index="3" name="w" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Returns a quaternion defined by these values.
|
||||
Constructs a quaternion defined by the given values.
|
||||
</description>
|
||||
</method>
|
||||
<method name="cubic_slerp">
|
||||
|
@ -68,7 +68,7 @@
|
|||
<argument index="3" name="t" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Performs a cubic spherical-linear interpolation with another quaternion.
|
||||
Performs a cubic spherical interpolation between quaternions [code]preA[/code], this vector, [code]b[/code], and [code]postB[/code], by the given amount [code]t[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="dot">
|
||||
|
@ -84,7 +84,7 @@
|
|||
<return type="Vector3">
|
||||
</return>
|
||||
<description>
|
||||
Returns Euler angles (in the YXZ convention: first Z, then X, and Y last) corresponding to the rotation represented by the unit quaternion. Returned vector contains the rotation angles in the format (X angle, Y angle, Z angle).
|
||||
Returns Euler angles (in the YXZ convention: when decomposing, first Z, then X, and Y last) corresponding to the rotation represented by the unit quaternion. Returned vector contains the rotation angles in the format (X angle, Y angle, Z angle).
|
||||
</description>
|
||||
</method>
|
||||
<method name="inverse">
|
||||
|
@ -144,7 +144,7 @@
|
|||
<argument index="0" name="euler" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the quaternion to a rotation specified by Euler angles (in the YXZ convention: first Z, then X, and Y last), given in the vector format as (X angle, Y angle, Z angle).
|
||||
Sets the quaternion to a rotation specified by Euler angles (in the YXZ convention: when decomposing, first Z, then X, and Y last), given in the vector format as (X angle, Y angle, Z angle).
|
||||
</description>
|
||||
</method>
|
||||
<method name="slerp">
|
||||
|
@ -155,7 +155,8 @@
|
|||
<argument index="1" name="t" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Performs a spherical-linear interpolation with another quaternion.
|
||||
Returns the result of the spherical linear interpolation between this quaternion and [code]to[/code] by amount [code]weight[/code].
|
||||
[b]Note:[/b] Both quaternions must be normalized.
|
||||
</description>
|
||||
</method>
|
||||
<method name="slerpni">
|
||||
|
@ -166,7 +167,7 @@
|
|||
<argument index="1" name="t" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Performs a spherical-linear interpolation with another quaterion without checking if the rotation path is not bigger than 90°.
|
||||
Returns the result of the spherical linear interpolation between this quaternion and [code]to[/code] by amount [code]weight[/code], but without checking if the rotation path is not bigger than 90 degrees.
|
||||
</description>
|
||||
</method>
|
||||
<method name="xform">
|
||||
|
@ -175,27 +176,31 @@
|
|||
<argument index="0" name="v" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Transforms the vector [code]v[/code] by this quaternion.
|
||||
Returns a vector transformed (multiplied) by this quaternion.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="w" type="float" setter="" getter="" default="1.0">
|
||||
W component of the quaternion.
|
||||
W component of the quaternion (real part).
|
||||
Quaternion components should usually not be manipulated directly.
|
||||
</member>
|
||||
<member name="x" type="float" setter="" getter="" default="0.0">
|
||||
X component of the quaternion.
|
||||
X component of the quaternion (imaginary [code]i[/code] axis part).
|
||||
Quaternion components should usually not be manipulated directly.
|
||||
</member>
|
||||
<member name="y" type="float" setter="" getter="" default="0.0">
|
||||
Y component of the quaternion.
|
||||
Y component of the quaternion (imaginary [code]j[/code] axis part).
|
||||
Quaternion components should usually not be manipulated directly.
|
||||
</member>
|
||||
<member name="z" type="float" setter="" getter="" default="0.0">
|
||||
Z component of the quaternion.
|
||||
Z component of the quaternion (imaginary [code]k[/code] axis part).
|
||||
Quaternion components should usually not be manipulated directly.
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
<constant name="IDENTITY" value="Quat( 0, 0, 0, 1 )">
|
||||
The identity rotation. Equivalent to an identity matrix. If a vector is transformed by an identity quaternion, it will not change.
|
||||
The identity quaternion, representing no rotation. Equivalent to an identity [Basis] matrix. If a vector is transformed by an identity quaternion, it will not change.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
|
|
@ -161,13 +161,14 @@
|
|||
</methods>
|
||||
<members>
|
||||
<member name="end" type="Vector2" setter="" getter="" default="Vector2( 0, 0 )">
|
||||
Ending corner.
|
||||
Ending corner. This is calculated as [code]position + size[/code]. Setting this value will change the size.
|
||||
</member>
|
||||
<member name="position" type="Vector2" setter="" getter="" default="Vector2( 0, 0 )">
|
||||
Position (starting corner).
|
||||
Beginning corner. Typically has values lower than [member end].
|
||||
</member>
|
||||
<member name="size" type="Vector2" setter="" getter="" default="Vector2( 0, 0 )">
|
||||
Size from position to end.
|
||||
Size from [member position] to [member end]. Typically all components are positive.
|
||||
If the size is negative, you can use [method abs] to fix it.
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
|
|
|
@ -4,10 +4,12 @@
|
|||
3D transformation (3×4 matrix).
|
||||
</brief_description>
|
||||
<description>
|
||||
Represents one or many transformations in 3D space such as translation, rotation, or scaling. It consists of a [member basis] and an [member origin]. It is similar to a 3×4 matrix.
|
||||
3×4 matrix (3 rows, 4 columns) used for 3D linear transformations. It can represent transformations such as translation, rotation, or scaling. It consists of a [member basis] (first 3 columns) and a [Vector3] for the [member origin] (last column).
|
||||
For more information, read the "Matrices and transforms" documentation article.
|
||||
</description>
|
||||
<tutorials>
|
||||
<link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link>
|
||||
<link>https://docs.godotengine.org/en/latest/tutorials/math/matrices_and_transforms.html</link>
|
||||
<link>https://docs.godotengine.org/en/latest/tutorials/3d/using_transforms.html</link>
|
||||
</tutorials>
|
||||
<methods>
|
||||
|
@ -23,7 +25,7 @@
|
|||
<argument index="3" name="origin" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Constructs the Transform from four [Vector3]. Each axis corresponds to local basis vectors (some of which may be scaled).
|
||||
Constructs a Transform from four [Vector3] values (matrix columns). Each axis corresponds to local basis vectors (some of which may be scaled).
|
||||
</description>
|
||||
</method>
|
||||
<method name="Transform">
|
||||
|
@ -34,7 +36,7 @@
|
|||
<argument index="1" name="origin" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Constructs the Transform from a [Basis] and [Vector3].
|
||||
Constructs a Transform from a [Basis] and [Vector3].
|
||||
</description>
|
||||
</method>
|
||||
<method name="Transform">
|
||||
|
@ -43,7 +45,7 @@
|
|||
<argument index="0" name="from" type="Transform2D">
|
||||
</argument>
|
||||
<description>
|
||||
Constructs the Transform from a [Transform2D].
|
||||
Constructs a Transform from a [Transform2D].
|
||||
</description>
|
||||
</method>
|
||||
<method name="Transform">
|
||||
|
@ -52,7 +54,7 @@
|
|||
<argument index="0" name="from" type="Quat">
|
||||
</argument>
|
||||
<description>
|
||||
Constructs the Transform from a [Quat]. The origin will be Vector3(0, 0, 0).
|
||||
Constructs a Transform from a [Quat]. The origin will be [code]Vector3(0, 0, 0)[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="Transform">
|
||||
|
@ -79,7 +81,7 @@
|
|||
<argument index="1" name="weight" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Interpolates the transform to other Transform by weight amount (0-1).
|
||||
Interpolates the transform to other Transform by weight amount (on the range of 0.0 to 1.0).
|
||||
</description>
|
||||
</method>
|
||||
<method name="inverse">
|
||||
|
@ -172,7 +174,7 @@
|
|||
The basis is a matrix containing 3 [Vector3] as its columns: X axis, Y axis, and Z axis. These vectors can be interpreted as the basis vectors of local coordinate system traveling with the object.
|
||||
</member>
|
||||
<member name="origin" type="Vector3" setter="" getter="" default="Vector3( 0, 0, 0 )">
|
||||
The translation offset of the transform.
|
||||
The translation offset of the transform (column 3, the fourth column). Equivalent to array index [code]3[/code].
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="Transform2D" version="3.2">
|
||||
<brief_description>
|
||||
2D transformation (3×2 matrix).
|
||||
2D transformation (2×3 matrix).
|
||||
</brief_description>
|
||||
<description>
|
||||
Represents one or many transformations in 2D space such as translation, rotation, or scaling. It consists of two [member x] and [member y] [Vector2]s and an [member origin]. It is similar to a 3×2 matrix.
|
||||
2×3 matrix (2 rows, 3 columns) used for 2D linear transformations. It can represent transformations such as translation, rotation, or scaling. It consists of a three [Vector2] values: [member x], [member y], and the [member origin].
|
||||
For more information, read the "Matrices and transforms" documentation article.
|
||||
</description>
|
||||
<tutorials>
|
||||
<link>https://docs.godotengine.org/en/latest/tutorials/math/matrices_and_transforms.html</link>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="Transform2D">
|
||||
|
@ -28,7 +30,7 @@
|
|||
<argument index="2" name="origin" type="Vector2">
|
||||
</argument>
|
||||
<description>
|
||||
Constructs the transform from 3 [Vector2]s representing x, y, and origin.
|
||||
Constructs the transform from 3 [Vector2] values representing [member x], [member y], and the [member origin] (the three column vectors).
|
||||
</description>
|
||||
</method>
|
||||
<method name="Transform2D">
|
||||
|
@ -46,7 +48,7 @@
|
|||
<return type="Transform2D">
|
||||
</return>
|
||||
<description>
|
||||
Returns the inverse of the matrix.
|
||||
Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling and translation.
|
||||
</description>
|
||||
</method>
|
||||
<method name="basis_xform">
|
||||
|
@ -55,7 +57,8 @@
|
|||
<argument index="0" name="v" type="Vector2">
|
||||
</argument>
|
||||
<description>
|
||||
Transforms the given vector by this transform's basis (no translation).
|
||||
Returns a vector transformed (multiplied) by the basis matrix.
|
||||
This method does not account for translation (the origin vector).
|
||||
</description>
|
||||
</method>
|
||||
<method name="basis_xform_inv">
|
||||
|
@ -64,7 +67,8 @@
|
|||
<argument index="0" name="v" type="Vector2">
|
||||
</argument>
|
||||
<description>
|
||||
Inverse-transforms the given vector by this transform's basis (no translation).
|
||||
Returns a vector transformed (multiplied) by the inverse basis matrix.
|
||||
This method does not account for translation (the origin vector).
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_origin">
|
||||
|
@ -96,14 +100,14 @@
|
|||
<argument index="1" name="weight" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Returns a transform interpolated between this transform and another by a given weight (0-1).
|
||||
Returns a transform interpolated between this transform and another by a given weight (on the range of 0.0 to 1.0).
|
||||
</description>
|
||||
</method>
|
||||
<method name="inverse">
|
||||
<return type="Transform2D">
|
||||
</return>
|
||||
<description>
|
||||
Returns the inverse of the transform, under the assumption that the transformation is composed of rotation and translation (no scaling, use affine_inverse for transforms with scaling).
|
||||
Returns the inverse of the transform, under the assumption that the transformation is composed of rotation and translation (no scaling, use [method affine_inverse] for transforms with scaling).
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_equal_approx">
|
||||
|
@ -119,7 +123,7 @@
|
|||
<return type="Transform2D">
|
||||
</return>
|
||||
<description>
|
||||
Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors.
|
||||
Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors (scale of 1 or -1).
|
||||
</description>
|
||||
</method>
|
||||
<method name="rotated">
|
||||
|
@ -171,24 +175,24 @@
|
|||
</methods>
|
||||
<members>
|
||||
<member name="origin" type="Vector2" setter="" getter="" default="Vector2( 0, 0 )">
|
||||
The transform's translation offset.
|
||||
The origin vector (column 2, the third column). Equivalent to array index [code]2[/code]. The origin vector represents translation.
|
||||
</member>
|
||||
<member name="x" type="Vector2" setter="" getter="" default="Vector2( 1, 0 )">
|
||||
The X axis of 2×2 basis matrix containing 2 [Vector2]s as its columns: X axis and Y axis. These vectors can be interpreted as the basis vectors of local coordinate system traveling with the object.
|
||||
The basis matrix's X vector (column 0). Equivalent to array index [code]0[/code].
|
||||
</member>
|
||||
<member name="y" type="Vector2" setter="" getter="" default="Vector2( 0, 1 )">
|
||||
The Y axis of 2×2 basis matrix containing 2 [Vector2]s as its columns: X axis and Y axis. These vectors can be interpreted as the basis vectors of local coordinate system traveling with the object.
|
||||
The basis matrix's Y vector (column 1). Equivalent to array index [code]1[/code].
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
<constant name="IDENTITY" value="Transform2D( 1, 0, 0, 1, 0, 0 )">
|
||||
[Transform2D] with no translation, rotation or scaling applied. When applied to other data structures, [constant IDENTITY] performs no transformation.
|
||||
The identity [Transform2D] with no translation, rotation or scaling applied. When applied to other data structures, [constant IDENTITY] performs no transformation.
|
||||
</constant>
|
||||
<constant name="FLIP_X" value="Transform2D( -1, 0, 0, 1, 0, 0 )">
|
||||
[Transform2D] with mirroring applied parallel to the X axis.
|
||||
The [Transform2D] that will flip something along the X axis.
|
||||
</constant>
|
||||
<constant name="FLIP_Y" value="Transform2D( 1, 0, 0, -1, 0, 0 )">
|
||||
[Transform2D] with mirroring applied parallel to the Y axis.
|
||||
The [Transform2D] that will flip something along the Y axis.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<return type="float">
|
||||
</return>
|
||||
<description>
|
||||
Returns the vector's angle in radians with respect to the X axis, or [code](1, 0)[/code] vector.
|
||||
Returns this vector's angle with respect to the X axis, or [code](1, 0)[/code] vector, in radians.
|
||||
Equivalent to the result of [method @GDScript.atan2] when called with the vector's [member y] and [member x] as parameters: [code]atan2(y, x)[/code].
|
||||
</description>
|
||||
</method>
|
||||
|
@ -43,7 +43,7 @@
|
|||
<argument index="0" name="to" type="Vector2">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the angle in radians between the two vectors.
|
||||
Returns the angle to the given vector, in radians.
|
||||
</description>
|
||||
</method>
|
||||
<method name="angle_to_point">
|
||||
|
@ -52,14 +52,14 @@
|
|||
<argument index="0" name="to" type="Vector2">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the angle in radians between the line connecting the two points and the X coordinate.
|
||||
Returns the angle between the line connecting the two points and the X axis, in radians.
|
||||
</description>
|
||||
</method>
|
||||
<method name="aspect">
|
||||
<return type="float">
|
||||
</return>
|
||||
<description>
|
||||
Returns the ratio of [member x] to [member y].
|
||||
Returns the aspect ratio of this vector, the ratio of [member x] to [member y].
|
||||
</description>
|
||||
</method>
|
||||
<method name="bounce">
|
||||
|
@ -75,7 +75,7 @@
|
|||
<return type="Vector2">
|
||||
</return>
|
||||
<description>
|
||||
Returns the vector with all components rounded up.
|
||||
Returns the vector with all components rounded up (towards positive infinity).
|
||||
</description>
|
||||
</method>
|
||||
<method name="clamped">
|
||||
|
@ -84,7 +84,7 @@
|
|||
<argument index="0" name="length" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the vector with a maximum length.
|
||||
Returns the vector with a maximum length by limiting its length to [code]length[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="cross">
|
||||
|
@ -93,7 +93,7 @@
|
|||
<argument index="0" name="with" type="Vector2">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the 2-dimensional analog of the cross product with the given vector.
|
||||
Returns the cross product of this vector and [code]with[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="cubic_interpolate">
|
||||
|
@ -108,7 +108,7 @@
|
|||
<argument index="3" name="t" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Cubically interpolates between this vector and [code]b[/code] using [code]pre_a[/code] and [code]post_b[/code] as handles, and returns the result at position [code]t[/code]. [code]t[/code] is in the range of [code]0.0 - 1.0[/code], representing the amount of interpolation.
|
||||
Cubically interpolates between this vector and [code]b[/code] using [code]pre_a[/code] and [code]post_b[/code] as handles, and returns the result at position [code]t[/code]. [code]t[/code] is on the range of 0.0 to 1.0, representing the amount of interpolation.
|
||||
</description>
|
||||
</method>
|
||||
<method name="direction_to">
|
||||
|
@ -126,7 +126,8 @@
|
|||
<argument index="0" name="to" type="Vector2">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the squared distance to vector [code]b[/code]. Prefer this function over [method distance_to] if you need to sort vectors or need the squared distance for some formula.
|
||||
Returns the squared distance between this vector and [code]b[/code].
|
||||
This method runs faster than [method distance_to], so prefer it if you need to compare vectors or need the squared distance for some formula.
|
||||
</description>
|
||||
</method>
|
||||
<method name="distance_to">
|
||||
|
@ -135,7 +136,7 @@
|
|||
<argument index="0" name="to" type="Vector2">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the distance to vector [code]b[/code].
|
||||
Returns the distance between this vector and [code]to[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="dot">
|
||||
|
@ -144,14 +145,17 @@
|
|||
<argument index="0" name="with" type="Vector2">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the dot product with vector [code]b[/code].
|
||||
Returns the dot product of this vector and [code]with[/code]. This can be used to compare the angle between two vectors. For example, this can be used to determine whether an enemy is facing the player.
|
||||
The dot product will be [code]0[/code] for a straight angle (90 degrees), greater than 0 for angles narrower than 90 degrees and lower than 0 for angles wider than 90 degrees.
|
||||
When using unit (normalized) vectors, the result will always be between [code]-1.0[/code] (180 degree angle) when the vectors are facing opposite directions, and [code]1.0[/code] (0 degree angle) when the vectors are aligned.
|
||||
[b]Note:[/b] [code]a.dot(b)[/code] is equivalent to [code]b.dot(a)[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="floor">
|
||||
<return type="Vector2">
|
||||
</return>
|
||||
<description>
|
||||
Returns the vector with all components rounded down.
|
||||
Returns the vector with all components rounded down (towards negative infinity).
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_equal_approx">
|
||||
|
@ -167,21 +171,22 @@
|
|||
<return type="bool">
|
||||
</return>
|
||||
<description>
|
||||
Returns [code]true[/code] if the vector is normalized.
|
||||
Returns [code]true[/code] if the vector is normalized, and false otherwise.
|
||||
</description>
|
||||
</method>
|
||||
<method name="length">
|
||||
<return type="float">
|
||||
</return>
|
||||
<description>
|
||||
Returns the vector's length.
|
||||
Returns the length (magnitude) of this vector.
|
||||
</description>
|
||||
</method>
|
||||
<method name="length_squared">
|
||||
<return type="float">
|
||||
</return>
|
||||
<description>
|
||||
Returns the vector's length squared. Prefer this method over [method length] if you need to sort vectors or need the squared length for some formula.
|
||||
Returns the squared length (squared magnitude) of this vector.
|
||||
This method runs faster than [method length], so prefer it if you need to compare vectors or need the squared distance for some formula.
|
||||
</description>
|
||||
</method>
|
||||
<method name="linear_interpolate">
|
||||
|
@ -192,7 +197,7 @@
|
|||
<argument index="1" name="t" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the result of the linear interpolation between this vector and [code]b[/code] by amount [code]t[/code]. [code]t[/code] is in the range of [code]0.0 - 1.0[/code], representing the amount of interpolation.
|
||||
Returns the result of the linear interpolation between this vector and [code]b[/code] by amount [code]t[/code]. [code]t[/code] is on the range of 0.0 to 1.0, representing the amount of interpolation.
|
||||
</description>
|
||||
</method>
|
||||
<method name="move_toward">
|
||||
|
@ -219,7 +224,7 @@
|
|||
<argument index="0" name="mod" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Returns a vector composed of the [code]fposmod[/code] of this vector's components and [code]mod[/code].
|
||||
Returns a vector composed of the [method @GDScript.fposmod] of this vector's components and [code]mod[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="posmodv">
|
||||
|
@ -228,7 +233,7 @@
|
|||
<argument index="0" name="modv" type="Vector2">
|
||||
</argument>
|
||||
<description>
|
||||
Returns a vector composed of the [code]fposmod[/code] of this vector's components and [code]modv[/code]'s components.
|
||||
Returns a vector composed of the [method @GDScript.fposmod] of this vector's components and [code]modv[/code]'s components.
|
||||
</description>
|
||||
</method>
|
||||
<method name="project">
|
||||
|
@ -269,7 +274,7 @@
|
|||
<return type="Vector2">
|
||||
</return>
|
||||
<description>
|
||||
Returns the vector with each component set to one or negative one, depending on the signs of the components.
|
||||
Returns the vector with each component set to one or negative one, depending on the signs of the components, or zero if the component is zero, by calling [method @GDScript.sign] on each component.
|
||||
</description>
|
||||
</method>
|
||||
<method name="slerp">
|
||||
|
@ -280,7 +285,7 @@
|
|||
<argument index="1" name="t" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the result of spherical linear interpolation between this vector and [code]b[/code], by amount [code]t[/code]. [code]t[/code] is in the range of [code]0.0 - 1.0[/code], representing the amount of interpolation.
|
||||
Returns the result of spherical linear interpolation between this vector and [code]b[/code], by amount [code]t[/code]. [code]t[/code] is on the range of 0.0 to 1.0, representing the amount of interpolation.
|
||||
[b]Note:[/b] Both vectors must be normalized.
|
||||
</description>
|
||||
</method>
|
||||
|
@ -290,7 +295,7 @@
|
|||
<argument index="0" name="n" type="Vector2">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the component of the vector along a plane defined by the given normal.
|
||||
Returns this vector slid along a plane defined by the given normal.
|
||||
</description>
|
||||
</method>
|
||||
<method name="snapped">
|
||||
|
@ -299,14 +304,14 @@
|
|||
<argument index="0" name="by" type="Vector2">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the vector snapped to a grid with the given size.
|
||||
Returns this vector with each component snapped to the nearest multiple of [code]step[/code]. This can also be used to round to an arbitrary number of decimals.
|
||||
</description>
|
||||
</method>
|
||||
<method name="tangent">
|
||||
<return type="Vector2">
|
||||
</return>
|
||||
<description>
|
||||
Returns a perpendicular vector.
|
||||
Returns a perpendicular vector rotated 90 degrees counter-clockwise compared to the original, with the same length.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
|
@ -326,25 +331,25 @@
|
|||
Enumerated value for the Y axis.
|
||||
</constant>
|
||||
<constant name="ZERO" value="Vector2( 0, 0 )">
|
||||
Zero vector.
|
||||
Zero vector, a vector with all components set to [code]0[/code].
|
||||
</constant>
|
||||
<constant name="ONE" value="Vector2( 1, 1 )">
|
||||
One vector.
|
||||
One vector, a vector with all components set to [code]1[/code].
|
||||
</constant>
|
||||
<constant name="INF" value="Vector2( inf, inf )">
|
||||
Infinity vector.
|
||||
Infinity vector, a vector with all components set to [constant @GDScript.INF].
|
||||
</constant>
|
||||
<constant name="LEFT" value="Vector2( -1, 0 )">
|
||||
Left unit vector.
|
||||
Left unit vector. Represents the direction of left.
|
||||
</constant>
|
||||
<constant name="RIGHT" value="Vector2( 1, 0 )">
|
||||
Right unit vector.
|
||||
Right unit vector. Represents the direction of right.
|
||||
</constant>
|
||||
<constant name="UP" value="Vector2( 0, -1 )">
|
||||
Up unit vector.
|
||||
Up unit vector. Y is down in 2D, so this vector points -Y.
|
||||
</constant>
|
||||
<constant name="DOWN" value="Vector2( 0, 1 )">
|
||||
Down unit vector.
|
||||
Down unit vector. Y is down in 2D, so this vector points +Y.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<argument index="0" name="to" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the minimum angle to the given vector.
|
||||
Returns the minimum angle to the given vector, in radians.
|
||||
</description>
|
||||
</method>
|
||||
<method name="bounce">
|
||||
|
@ -53,7 +53,7 @@
|
|||
<return type="Vector3">
|
||||
</return>
|
||||
<description>
|
||||
Returns a new vector with all components rounded up.
|
||||
Returns a new vector with all components rounded up (towards positive infinity).
|
||||
</description>
|
||||
</method>
|
||||
<method name="cross">
|
||||
|
@ -62,7 +62,7 @@
|
|||
<argument index="0" name="b" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the cross product with [code]b[/code].
|
||||
Returns the cross product of this vector and [code]b[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="cubic_interpolate">
|
||||
|
@ -77,7 +77,7 @@
|
|||
<argument index="3" name="t" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Performs a cubic interpolation between vectors [code]pre_a[/code], [code]a[/code], [code]b[/code], [code]post_b[/code] ([code]a[/code] is current), by the given amount [code]t[/code]. [code]t[/code] is in the range of [code]0.0 - 1.0[/code], representing the amount of interpolation.
|
||||
Performs a cubic interpolation between vectors [code]pre_a[/code], [code]a[/code], [code]b[/code], [code]post_b[/code] ([code]a[/code] is current), by the given amount [code]t[/code]. [code]t[/code] is on the range of 0.0 to 1.0, representing the amount of interpolation.
|
||||
</description>
|
||||
</method>
|
||||
<method name="direction_to">
|
||||
|
@ -95,7 +95,8 @@
|
|||
<argument index="0" name="b" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the squared distance to [code]b[/code]. Prefer this function over [method distance_to] if you need to sort vectors or need the squared distance for some formula.
|
||||
Returns the squared distance between this vector and [code]b[/code].
|
||||
This method runs faster than [method distance_to], so prefer it if you need to compare vectors or need the squared distance for some formula.
|
||||
</description>
|
||||
</method>
|
||||
<method name="distance_to">
|
||||
|
@ -104,7 +105,7 @@
|
|||
<argument index="0" name="b" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the distance to [code]b[/code].
|
||||
Returns the distance between this vector and [code]b[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="dot">
|
||||
|
@ -113,14 +114,17 @@
|
|||
<argument index="0" name="b" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the dot product with [code]b[/code].
|
||||
Returns the dot product of this vector and [code]b[/code]. This can be used to compare the angle between two vectors. For example, this can be used to determine whether an enemy is facing the player.
|
||||
The dot product will be [code]0[/code] for a straight angle (90 degrees), greater than 0 for angles narrower than 90 degrees and lower than 0 for angles wider than 90 degrees.
|
||||
When using unit (normalized) vectors, the result will always be between [code]-1.0[/code] (180 degree angle) when the vectors are facing opposite directions, and [code]1.0[/code] (0 degree angle) when the vectors are aligned.
|
||||
[b]Note:[/b] [code]a.dot(b)[/code] is equivalent to [code]b.dot(a)[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="floor">
|
||||
<return type="Vector3">
|
||||
</return>
|
||||
<description>
|
||||
Returns a new vector with all components rounded down.
|
||||
Returns a new vector with all components rounded down (towards negative infinity).
|
||||
</description>
|
||||
</method>
|
||||
<method name="inverse">
|
||||
|
@ -143,21 +147,22 @@
|
|||
<return type="bool">
|
||||
</return>
|
||||
<description>
|
||||
Returns [code]true[/code] if the vector is normalized.
|
||||
Returns [code]true[/code] if the vector is normalized, and false otherwise.
|
||||
</description>
|
||||
</method>
|
||||
<method name="length">
|
||||
<return type="float">
|
||||
</return>
|
||||
<description>
|
||||
Returns the vector's length.
|
||||
Returns the length (magnitude) of this vector.
|
||||
</description>
|
||||
</method>
|
||||
<method name="length_squared">
|
||||
<return type="float">
|
||||
</return>
|
||||
<description>
|
||||
Returns the vector's length squared. Prefer this function over [method length] if you need to sort vectors or need the squared length for some formula.
|
||||
Returns the squared length (squared magnitude) of this vector.
|
||||
This method runs faster than [method length], so prefer it if you need to compare vectors or need the squared distance for some formula.
|
||||
</description>
|
||||
</method>
|
||||
<method name="linear_interpolate">
|
||||
|
@ -168,21 +173,21 @@
|
|||
<argument index="1" name="t" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the result of the linear interpolation between this vector and [code]b[/code] by amount [code]t[/code]. [code]t[/code] is in the range of [code]0.0 - 1.0[/code], representing the amount of interpolation..
|
||||
Returns the result of the linear interpolation between this vector and [code]b[/code] by amount [code]t[/code]. [code]t[/code] is on the range of 0.0 to 1.0, representing the amount of interpolation.
|
||||
</description>
|
||||
</method>
|
||||
<method name="max_axis">
|
||||
<return type="int">
|
||||
</return>
|
||||
<description>
|
||||
Returns the axis of the vector's largest value. See [code]AXIS_*[/code] constants.
|
||||
Returns the axis of the vector's largest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_X].
|
||||
</description>
|
||||
</method>
|
||||
<method name="min_axis">
|
||||
<return type="int">
|
||||
</return>
|
||||
<description>
|
||||
Returns the axis of the vector's smallest value. See [code]AXIS_*[/code] constants.
|
||||
Returns the axis of the vector's smallest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_Z].
|
||||
</description>
|
||||
</method>
|
||||
<method name="move_toward">
|
||||
|
@ -193,7 +198,7 @@
|
|||
<argument index="1" name="delta" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Moves the vector toward [code]to[/code] by the fixed [code]delta[/code] amount.
|
||||
Moves this vector toward [code]to[/code] by the fixed [code]delta[/code] amount.
|
||||
</description>
|
||||
</method>
|
||||
<method name="normalized">
|
||||
|
@ -218,7 +223,7 @@
|
|||
<argument index="0" name="mod" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Returns a vector composed of the [code]fposmod[/code] of this vector's components and [code]mod[/code].
|
||||
Returns a vector composed of the [method @GDScript.fposmod] of this vector's components and [code]mod[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="posmodv">
|
||||
|
@ -227,7 +232,7 @@
|
|||
<argument index="0" name="modv" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Returns a vector composed of the [code]fposmod[/code] of this vector's components and [code]modv[/code]'s components.
|
||||
Returns a vector composed of the [method @GDScript.fposmod] of this vector's components and [code]modv[/code]'s components.
|
||||
</description>
|
||||
</method>
|
||||
<method name="project">
|
||||
|
@ -236,7 +241,7 @@
|
|||
<argument index="0" name="b" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the vector projected onto the vector [code]b[/code].
|
||||
Returns this vector projected onto another vector [code]b[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="reflect">
|
||||
|
@ -245,7 +250,7 @@
|
|||
<argument index="0" name="n" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the vector reflected from a plane defined by the given normal.
|
||||
Returns this vector reflected from a plane defined by the given normal.
|
||||
</description>
|
||||
</method>
|
||||
<method name="rotated">
|
||||
|
@ -256,21 +261,21 @@
|
|||
<argument index="1" name="phi" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Rotates the vector around a given axis by [code]phi[/code] radians. The axis must be a normalized vector.
|
||||
Rotates this vector around a given axis by [code]phi[/code] radians. The axis must be a normalized vector.
|
||||
</description>
|
||||
</method>
|
||||
<method name="round">
|
||||
<return type="Vector3">
|
||||
</return>
|
||||
<description>
|
||||
Returns the vector with all components rounded to the nearest integer, with halfway cases rounded away from zero.
|
||||
Returns this vector with all components rounded to the nearest integer, with halfway cases rounded away from zero.
|
||||
</description>
|
||||
</method>
|
||||
<method name="sign">
|
||||
<return type="Vector3">
|
||||
</return>
|
||||
<description>
|
||||
Returns the vector with each component set to one or negative one, depending on the signs of the components.
|
||||
Returns a vector with each component set to one or negative one, depending on the signs of this vector's components, or zero if the component is zero, by calling [method @GDScript.sign] on each component.
|
||||
</description>
|
||||
</method>
|
||||
<method name="slerp">
|
||||
|
@ -281,7 +286,7 @@
|
|||
<argument index="1" name="t" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the result of spherical linear interpolation between this vector and [code]b[/code], by amount [code]t[/code]. [code]t[/code] is in the range of [code]0.0 - 1.0[/code], representing the amount of interpolation.
|
||||
Returns the result of spherical linear interpolation between this vector and [code]b[/code], by amount [code]t[/code]. [code]t[/code] is on the range of 0.0 to 1.0, representing the amount of interpolation.
|
||||
[b]Note:[/b] Both vectors must be normalized.
|
||||
</description>
|
||||
</method>
|
||||
|
@ -291,7 +296,7 @@
|
|||
<argument index="0" name="n" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the component of the vector along a plane defined by the given normal.
|
||||
Returns this vector slid along a plane defined by the given normal.
|
||||
</description>
|
||||
</method>
|
||||
<method name="snapped">
|
||||
|
@ -300,7 +305,7 @@
|
|||
<argument index="0" name="by" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the vector snapped to a grid with the given size.
|
||||
Returns this vector with each component snapped to the nearest multiple of [code]step[/code]. This can also be used to round to an arbitrary number of decimals.
|
||||
</description>
|
||||
</method>
|
||||
<method name="to_diagonal_matrix">
|
||||
|
@ -308,6 +313,7 @@
|
|||
</return>
|
||||
<description>
|
||||
Returns a diagonal matrix with the vector as main diagonal.
|
||||
This is equivalent to a Basis with no rotation or shearing and this vector's components set as the scale.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
|
@ -333,19 +339,19 @@
|
|||
Enumerated value for the Z axis. Returned by [method max_axis] and [method min_axis].
|
||||
</constant>
|
||||
<constant name="ZERO" value="Vector3( 0, 0, 0 )">
|
||||
Zero vector.
|
||||
Zero vector, a vector with all components set to [code]0[/code].
|
||||
</constant>
|
||||
<constant name="ONE" value="Vector3( 1, 1, 1 )">
|
||||
One vector.
|
||||
One vector, a vector with all components set to [code]1[/code].
|
||||
</constant>
|
||||
<constant name="INF" value="Vector3( inf, inf, inf )">
|
||||
Infinity vector.
|
||||
Infinity vector, a vector with all components set to [constant @GDScript.INF].
|
||||
</constant>
|
||||
<constant name="LEFT" value="Vector3( -1, 0, 0 )">
|
||||
Left unit vector.
|
||||
Left unit vector. Represents the local direction of left, and the global direction of west.
|
||||
</constant>
|
||||
<constant name="RIGHT" value="Vector3( 1, 0, 0 )">
|
||||
Right unit vector.
|
||||
Right unit vector. Represents the local direction of right, and the global direction of east.
|
||||
</constant>
|
||||
<constant name="UP" value="Vector3( 0, 1, 0 )">
|
||||
Up unit vector.
|
||||
|
@ -354,10 +360,10 @@
|
|||
Down unit vector.
|
||||
</constant>
|
||||
<constant name="FORWARD" value="Vector3( 0, 0, -1 )">
|
||||
Forward unit vector.
|
||||
Forward unit vector. Represents the local direction of forward, and the global direction of north.
|
||||
</constant>
|
||||
<constant name="BACK" value="Vector3( 0, 0, 1 )">
|
||||
Back unit vector.
|
||||
Back unit vector. Represents the local direction of back, and the global direction of south.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<argument index="0" name="s" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the absolute value of parameter [code]s[/code] (i.e. unsigned value, works for integer and float).
|
||||
Returns the absolute value of parameter [code]s[/code] (i.e. positive value).
|
||||
[codeblock]
|
||||
# a is 1
|
||||
a = abs(-1)
|
||||
|
@ -112,7 +112,7 @@
|
|||
</argument>
|
||||
<description>
|
||||
Returns the arc tangent of [code]s[/code] in radians. Use it to get the angle from an angle's tangent in trigonometry: [code]atan(tan(angle)) == angle[/code].
|
||||
The method cannot know in which quadrant the angle should fall. See [method atan2] if you always want an exact angle.
|
||||
The method cannot know in which quadrant the angle should fall. See [method atan2] if you have both [code]y[code] and [code]x[/code].
|
||||
[codeblock]
|
||||
a = atan(0.5) # a is 0.463648
|
||||
[/codeblock]
|
||||
|
@ -127,6 +127,7 @@
|
|||
</argument>
|
||||
<description>
|
||||
Returns the arc tangent of [code]y/x[/code] in radians. Use to get the angle of tangent [code]y/x[/code]. To compute the value, the method takes into account the sign of both arguments in order to determine the quadrant.
|
||||
Important note: The Y coordinate comes first, by convention.
|
||||
[codeblock]
|
||||
a = atan2(0, -1) # a is 3.141593
|
||||
[/codeblock]
|
||||
|
@ -161,7 +162,7 @@
|
|||
<argument index="0" name="s" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Rounds [code]s[/code] upward, returning the smallest integral value that is not less than [code]s[/code].
|
||||
Rounds [code]s[/code] upward (towards positive infinity), returning the smallest whole number that is not less than [code]s[/code].
|
||||
[codeblock]
|
||||
i = ceil(1.45) # i is 2
|
||||
i = ceil(1.001) # i is 2
|
||||
|
@ -292,7 +293,7 @@
|
|||
<argument index="0" name="deg" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Returns degrees converted to radians.
|
||||
Converts an angle expressed in degrees to radians.
|
||||
[codeblock]
|
||||
# r is 3.141593
|
||||
r = deg2rad(180)
|
||||
|
@ -316,7 +317,7 @@
|
|||
<argument index="1" name="curve" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Easing function, based on exponent. 0 is constant, 1 is linear, 0 to 1 is ease-in, 1+ is ease out. Negative values are in-out/out in.
|
||||
Easing function, based on exponent. The curve values are: 0 is constant, 1 is linear, 0 to 1 is ease-in, 1+ is ease out. Negative values are in-out/out in.
|
||||
</description>
|
||||
</method>
|
||||
<method name="exp">
|
||||
|
@ -339,7 +340,7 @@
|
|||
<argument index="0" name="s" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Rounds [code]s[/code] to the closest smaller integer and returns it.
|
||||
Rounds [code]s[/code] downward (towards negative infinity), returning the largest whole number that is not more than [code]s[/code].
|
||||
[codeblock]
|
||||
# a is 2.0
|
||||
a = floor(2.99)
|
||||
|
@ -539,7 +540,7 @@
|
|||
<argument index="0" name="s" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Returns whether [code]s[/code] is a NaN (Not-A-Number) value.
|
||||
Returns whether [code]s[/code] is a NaN ("Not a Number" or invalid) value.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_zero_approx">
|
||||
|
@ -549,6 +550,7 @@
|
|||
</argument>
|
||||
<description>
|
||||
Returns [code]true[/code] if [code]s[/code] is zero or almost zero.
|
||||
This method is faster than using [method is_equal_approx] with one value as zero.
|
||||
</description>
|
||||
</method>
|
||||
<method name="len">
|
||||
|
@ -916,7 +918,7 @@
|
|||
<argument index="0" name="rad" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Converts from radians to degrees.
|
||||
Converts an angle expressed in radians to degrees.
|
||||
[codeblock]
|
||||
rad2deg(0.523599) # Returns 30
|
||||
[/codeblock]
|
||||
|
@ -1035,7 +1037,7 @@
|
|||
<argument index="0" name="s" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the integral value that is nearest to [code]s[/code], with halfway cases rounded away from zero.
|
||||
Rounds [code]s[/code] to the nearest whole number, with halfway cases rounded away from zero.
|
||||
[codeblock]
|
||||
round(2.6) # Returns 3
|
||||
[/codeblock]
|
||||
|
@ -1117,10 +1119,11 @@
|
|||
<argument index="0" name="s" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the square root of [code]s[/code].
|
||||
Returns the square root of [code]s[/code], where [code]s[/code] is a non-negative number.
|
||||
[codeblock]
|
||||
sqrt(9) # Returns 3
|
||||
[/codeblock]
|
||||
If you need negative inputs, use [code]System.Numerics.Complex[/code] in C#.
|
||||
</description>
|
||||
</method>
|
||||
<method name="step_decimals">
|
||||
|
@ -1321,27 +1324,19 @@
|
|||
Wraps float [code]value[/code] between [code]min[/code] and [code]max[/code].
|
||||
Usable for creating loop-alike behavior or infinite surfaces.
|
||||
[codeblock]
|
||||
# a is 0.5
|
||||
a = wrapf(10.5, 0.0, 10.0)
|
||||
[/codeblock]
|
||||
[codeblock]
|
||||
# a is 9.5
|
||||
a = wrapf(-0.5, 0.0, 10.0)
|
||||
[/codeblock]
|
||||
[codeblock]
|
||||
# Infinite loop between 0.0 and 0.99
|
||||
f = wrapf(f + 0.1, 0.0, 1.0)
|
||||
# Infinite loop between 5.0 and 9.9
|
||||
value = wrapf(value + 0.1, 5.0, 10.0)
|
||||
[/codeblock]
|
||||
[codeblock]
|
||||
# Infinite rotation (in radians)
|
||||
angle = wrapf(angle + 0.1, 0.0, TAU)
|
||||
[/codeblock]
|
||||
[b]Note:[/b] If you just want to wrap between 0.0 and [code]n[/code] (where [code]n[/code] is a positive floating-point value), it is better for performance to use the [method fmod] method like [code]fmod(number, n)[/code].
|
||||
[code]wrapf[/code] is more flexible than using the [method fmod] approach by giving the user a simple control over the minimum value. It also fully supports negative numbers, e.g.
|
||||
[codeblock]
|
||||
# Infinite rotation (in radians)
|
||||
angle = wrapf(angle + 0.1, -PI, PI)
|
||||
[/codeblock]
|
||||
[b]Note:[/b] If [code]min[/code] is [code]0[/code], this is equivalent to [method fposmod], so prefer using that instead.
|
||||
[code]wrapf[/code] is more flexible than using the [method fposmod] approach by giving the user control over the minimum value.
|
||||
</description>
|
||||
</method>
|
||||
<method name="wrapi">
|
||||
|
@ -1357,23 +1352,15 @@
|
|||
Wraps integer [code]value[/code] between [code]min[/code] and [code]max[/code].
|
||||
Usable for creating loop-alike behavior or infinite surfaces.
|
||||
[codeblock]
|
||||
# a is 0
|
||||
a = wrapi(10, 0, 10)
|
||||
# Infinite loop between 5 and 9
|
||||
frame = wrapi(frame + 1, 5, 10)
|
||||
[/codeblock]
|
||||
[codeblock]
|
||||
# a is 9
|
||||
a = wrapi(-1, 0, 10)
|
||||
[/codeblock]
|
||||
[codeblock]
|
||||
# Infinite loop between 0 and 9
|
||||
frame = wrapi(frame + 1, 0, 10)
|
||||
[/codeblock]
|
||||
[b]Note:[/b] If you just want to wrap between 0 and [code]n[/code] (where [code]n[/code] is a positive integer value), it is better for performance to use the modulo operator like [code]number % n[/code].
|
||||
[code]wrapi[/code] is more flexible than using the modulo approach by giving the user a simple control over the minimum value. It also fully supports negative numbers, e.g.
|
||||
[codeblock]
|
||||
# result is -2
|
||||
var result = wrapi(-6, -5, -1)
|
||||
[/codeblock]
|
||||
[b]Note:[/b] If [code]min[/code] is [code]0[/code], this is equivalent to [method posmod], so prefer using that instead.
|
||||
[code]wrapi[/code] is more flexible than using the [method posmod] approach by giving the user control over the minimum value.
|
||||
</description>
|
||||
</method>
|
||||
<method name="yield">
|
||||
|
@ -1415,17 +1402,16 @@
|
|||
</methods>
|
||||
<constants>
|
||||
<constant name="PI" value="3.141593">
|
||||
Constant that represents how many times the diameter of a circle fits around its perimeter.
|
||||
Constant that represents how many times the diameter of a circle fits around its perimeter. This is equivalent to [code]TAU / 2[/code].
|
||||
</constant>
|
||||
<constant name="TAU" value="6.283185">
|
||||
The circle constant, the circumference of the unit circle.
|
||||
The circle constant, the circumference of the unit circle in radians.
|
||||
</constant>
|
||||
<constant name="INF" value="inf">
|
||||
A positive infinity. (For negative infinity, use -INF).
|
||||
Positive infinity. For negative infinity, use -INF.
|
||||
</constant>
|
||||
<constant name="NAN" value="nan">
|
||||
Macro constant that expands to an expression of type float that represents a NaN.
|
||||
The NaN values are used to identify undefined or non-representable values for floating-point elements, such as the square root of negative numbers or the result of 0/0.
|
||||
"Not a Number", an invalid value. [code]NaN[/code] has special properties, including that it is not equal to itself. It is output by some invalid operations, such as dividing zero by zero.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
|
Loading…
Reference in New Issue