CollisionObject2D is the base class for 2D physics collisionables. They can hold any number of 2D collision shapes. Usually, they are edited by placing CollisionBody2D and CollisionPolygon2D nodes as children. Such nodes are for reference ant not present outside the editor, so code should use the regular shape API.
CollisionObject2D is the base class for 2D physics collisionables. They can hold any number of 2D collision shapes. Usually, they are edited by placing [CollisionBody2D] and [CollisionPolygon2D] nodes as children. Such nodes are for reference and not present outside the editor, so code should use the regular shape API.
Editor-only class for easy editing of collision polygons.
</brief_description>
<description>
Editor-Only class. This is not present when running the game. It's used in the editor to properly edit and position collision shapes in [CollisionObject2D]. This is not accessible from regular code. This class is for editing custom shape polygons.
Editor-only class. This is not present when running the game. It's used in the editor to properly edit and position collision shapes in [CollisionObject2D]. This is not accessible from regular code. This class is for editing custom shape polygons.
When editing the point list via the editor, depending on [method get_build_mode], it has to be a list of points (for [code]build_mode[/code]=0), or a list of lines (for [code]build_mode[/code]=1). In the second case, the even elements of the array define the start point of the line, and the odd elements the end point.
</description>
</method>
<methodname="get_polygon"qualifiers="const">
<returntype="Vector2Array">
</return>
<description>
Return the list of points that define the polygon.
</description>
</method>
<methodname="set_build_mode">
<argumentindex="0"name="arg0"type="int">
</argument>
<description>
Set whether the polygon is to be a [ConvexPolygon2D] ([code]build_mode[/code]=0), or a [ConcavePolygon2D] ([code]build_mode[/code]=1).
</description>
</method>
<methodname="get_build_mode"qualifiers="const">
<returntype="int">
</return>
<description>
Return whether the polygon is a [ConvexPolygon2D] ([code]build_mode[/code]=0), or a [ConcavePolygon2D] ([code]build_mode[/code]=1).
</description>
</method>
<methodname="set_trigger">
<argumentindex="0"name="arg0"type="bool">
</argument>
<description>
Set whether this polygon is a trigger. A trigger polygon detects collisions, but is otherwise unaffected by physics (i.e. colliding objects will not get blocked).
Return the index of the first shape generated by the editor.
When [code]build_mode[/code] is set to generate convex polygons, the shape shown in the editor may be decomopsed into many convex polygons. In that case, a range of indexes is needed to directly access the [Shape2D]s.
When [code]build_mode[/code] is set to generate concave polygons, there is only one [Shape2D] generated, so the start index and the end index are the same.
Editor-Only class. This is not present when running the game. It's used in the editor to properly edit and position collision shapes in [CollisionObject2D]. This is not accessible from regular code.
Editor-only class. This is not present when running the game. It's used in the editor to properly edit and position collision shapes in [CollisionObject2D]. This is not accessible from regular code.
</description>
<methods>
<methodname="set_shape">
<argumentindex="0"name="shape"type="Object">
</argument>
<description>
Set this shape's [Shape2D]. This will not appear as a node, but can be directly edited as a property.
</description>
</method>
<methodname="get_shape"qualifiers="const">
<returntype="Object">
</return>
<description>
Return this shape's [Shape2D].
</description>
</method>
<methodname="set_trigger">
<argumentindex="0"name="enable"type="bool">
</argument>
<description>
Set whether this shape is a trigger. A trigger shape detects collisions, but is otherwise unaffected by physics (i.e. will not block movement of colliding objects).
Return the index of this shape inside its container [CollisionObject2D]. This can be used to directly access the underlying [Shape2D].
</description>
</method>
</methods>
@ -7298,7 +7336,7 @@
Color in RGBA format.
</brief_description>
<description>
A color is represented as red, green and blue (r,g,b) components. Additionally, "a" represents the alpha component, often used for transparency. Values are in floating point and usually range from 0 to 1. Some methods (such as set_modulate() ) may accept values > 1.
A color is represented as red, green and blue (r,g,b) components. Additionally, "a" represents the alpha component, often used for transparency. Values are in floating point and usually range from 0 to 1. Some methods (such as set_modulate() ) may accept values > 1.
</description>
<methods>
<methodname="blend">
@ -7666,7 +7704,7 @@
Concave polygon shape.
</brief_description>
<description>
Concave polygon shape resource, which can be set into a [PhysicsBody] or area. This shape is created by feeding a list of triangles.
Concave polygon shape resource, which can be set into a [PhysicsBody] or area. This shape is created by feeding a list of triangles.
</description>
<methods>
<methodname="set_faces">
@ -7693,6 +7731,7 @@
</brief_description>
<description>
Concave polygon 2D shape resource for physics. It is made out of segments and is very optimal for complex polygonal concave collisions. It is really not advised to use for RigidBody nodes. A CollisionPolygon2D in convex decomposition mode (solids) or several convex objects are advised for that instead. Otherwise, a concave polygon 2D shape is better for static collisions.
The main difference between a [ConvexPolygonShape2D] and a [ConcavePolygonShape2D] is that a concave polygon assumes it is concave and uses a more complex method of collision detection, and a convex one forces itself to be convex in order to speed up collision detection.
</description>
<methods>
<methodname="set_segments">
@ -8583,14 +8622,15 @@
Convex Polygon Shape for 2D physics.
</brief_description>
<description>
Convex Polygon Shape for 2D physics.
Convex Polygon Shape for 2D physics. A convex polygon, whatever its shape, is internally decomposed into as many convex polygons as needed to ensure all collision checks against it are always done on convex polygons (which are faster to check).
The main difference between a [ConvexPolygonShape2D] and a [ConcavePolygonShape2D] is that a concave polygon assumes it is concave and uses a more complex method of collision detection, and a convex one forces itself to be convex in order to speed up collision detection.
Returns a list of points along the curve, with a curvature controlled point density. That is, the curvier parts will have more points than the straighter parts.
This approximation makes straight segments between each point, then subdivides those segments until the resulting shape is similar enough.
@ -8884,16 +8924,6 @@ This approximation makes straight segments between each point, then subdivides t
"tolerance_degrees" controls how many degrees the midpoint of a segment may deviate from the real curve, before the segment has to be subdivided.
Returns a list of points along the curve, with a curvature controlled point density. That is, the curvier parts will have more points than the straighter parts.
This approximation makes straight segments between each point, then subdivides those segments until the resulting shape is similar enough.
@ -9091,16 +9121,6 @@ This approximation makes straight segments between each point, then subdivides t
"tolerance_degrees" controls how many degrees the midpoint of a segment may deviate from the real curve, before the segment has to be subdivided.
@ -21573,16 +21640,16 @@ This method controls whether the position between two cached points is interpola
</methods>
<constants>
<constantname="ROTATION_NONE"value="0">
Forbids the PathFollow to rotate.
Forbids the PathFollow to rotate.
</constant>
<constantname="ROTATION_Y"value="1">
Allows the PathFollow to rotate in the Y axis only.
Allows the PathFollow to rotate in the Y axis only.
</constant>
<constantname="ROTATION_XY"value="2">
Allows the PathFollow to rotate in both the X, and Y axes.
Allows the PathFollow to rotate in both the X, and Y axes.
</constant>
<constantname="ROTATION_XYZ"value="3">
Allows the PathFollow to rotate in any axis.
Allows the PathFollow to rotate in any axis.
</constant>
</constants>
</class>
@ -21697,10 +21764,6 @@ This method controls whether the position between two cached points is interpola
</description>
</method>
</methods>
<members>
<membername="lookahead"type="float">
</member>
</members>
<constants>
</constants>
</class>
@ -26057,6 +26120,14 @@ This method controls whether the position between two cached points is interpola
<description>
</description>
</method>
<methodname="xform">
<returntype="Vector3">
</return>
<argumentindex="0"name="v"type="Vector3">
</argument>
<description>
</description>
</method>
<methodname="Quat">
<returntype="Quat">
</return>
@ -26301,12 +26372,14 @@ This method controls whether the position between two cached points is interpola
<returntype="String">
</return>
<description>
Returns a copy of the array's contents formatted as String. Fast alternative to get_string_from_utf8(), assuming the content is ASCII-only (unlike the UTF-8 function, this function maps every byte to a character in the string, so any multibyte sequence will be torn apart).
</description>
</method>
<methodname="get_string_from_utf8">
<returntype="String">
</return>
<description>
Returns a copy of the array's contents formatted as String, assuming the array is formatted as UTF-8. Slower than get_string_from_ascii(), but works for UTF-8. Usually you should prefer this function over get_string_from_ascii() to support international input.
</description>
</method>
<methodname="push_back">
@ -26584,19 +26657,21 @@ This method controls whether the position between two cached points is interpola
Ray 2D shape resource for physics.
</brief_description>
<description>
Ray 2D shape resource for physics. A ray is not really a collision body, isntead it tries to separate itself from whatever is touching its far endpoint. It's often useful for ccharacters.
Ray 2D shape resource for physics. A ray is not really a collision body, isntead it tries to separate itself from whatever is touching its far endpoint. It's often useful for characters.
</description>
<methods>
<methodname="set_length">
<argumentindex="0"name="length"type="float">
</argument>
<description>
Set the length of the ray.
</description>
</method>
<methodname="get_length"qualifiers="const">
<returntype="float">
</return>
<description>
Return the length of the ray.
</description>
</method>
</methods>
@ -26866,27 +26941,22 @@ This method controls whether the position between two cached points is interpola
<methods>
<methodname="compile">
<returntype="int">
[OK] if the regular expression was valid. [FAIL] otherwise.
</return>
<argumentindex="0"name="pattern"type="String">
The string to be converted into a regular expression.
Once created, a RegEx object needs a regular expression to be assigned to it. This method tries to convert the string given to an usable regular expression.
</description>
</method>
<methodname="find"qualifiers="const">
<returntype="int">
The position within the string (starting with 0) where the pattern was found. It will return -1 if the pattern was not found, it was invalid, or the start or end positions were beyond the string's end.
The position in the string (starting with 0) to stop searching. A value less than the start position means "end of the string".
</argument>
<description>
This method tries to find the pattern within the string, and returns the position where it was found. It also stores any capturing group (see [method get_capture]) for further retrieval.
@ -26915,7 +26985,6 @@ This method controls whether the position between two cached points is interpola
<returntype="String">
</return>
<argumentindex="0"name="capture"type="int">
The number of the captured group, starting with 0. Like other regular expression engines, Godot's engine takes 0 as the full expression, and 1 as the first pair of capturing parentheses.
</argument>
<description>
Returns a captured group. A captured group is the part of a string that matches a part of the pattern delimited by parentheses (unless they are non-capturing parentheses [i](?:)[/i]).
@ -26923,7 +26992,6 @@ This method controls whether the position between two cached points is interpola
</method>
<methodname="get_captures"qualifiers="const">
<returntype="StringArray">
A list contining all the strings captured by the regular expression.
</return>
<description>
Return a list of all the captures made by the regular expression.
@ -29543,24 +29611,28 @@ This method controls whether the position between two cached points is interpola
<argumentindex="0"name="a"type="Vector2">
</argument>
<description>
Set the first point's position.
</description>
</method>
<methodname="get_a"qualifiers="const">
<returntype="Vector2">
</return>
<description>
Return the first point's position.
</description>
</method>
<methodname="set_b">
<argumentindex="0"name="b"type="Vector2">
</argument>
<description>
Set the second point's position.
</description>
</method>
<methodname="get_b"qualifiers="const">
<returntype="Vector2">
</return>
<description>
Return the second point's position.
</description>
</method>
</methods>
@ -30608,13 +30680,14 @@ This method controls whether the position between two cached points is interpola
</argument>
<description>
Use a custom solver bias. No need to change this unless you really know what you are doing.
The solver bias is a factor controlling how much two objects "rebound" off each other, when colliding, to avoid them getting into each other because of numerical imprecision.
Return whether this shape is colliding with another.
This method needs the transformation matrix for this shape ([code]local_xform[/code]), the shape to check collisions with ([code]with_shape[/code]), and the transformation matrix of that shape ([code]shape_xform[/code]).
</description>
</method>
<methodname="collide_with_motion">
@ -30643,6 +30718,8 @@ This method controls whether the position between two cached points is interpola
Return whether this shape would collide with another, if a given movemen was applied.
This method needs the transformation matrix for this shape ([code]local_xform[/code]), the movement to test on this shape ([code]local_motion[/code]), the shape to check collisions with ([code]with_shape[/code]), the transformation matrix of that shape ([code]shape_xform[/code]), and the movement to test ont the other object ([code]shape_motion[/code]).
</description>
</method>
<methodname="collide_and_get_contacts">
@ -30653,6 +30730,8 @@ This method controls whether the position between two cached points is interpola
Return a list of the points where this shape touches another. If there are no collisions, the list is empty.
This method needs the transformation matrix for this shape ([code]local_xform[/code]), the shape to check collisions with ([code]with_shape[/code]), and the transformation matrix of that shape ([code]shape_xform[/code]).
Return a list of the points where this shape would touch another, if a given movement was applied. If there are no collisions, the list is empty.
This method needs the transformation matrix for this shape ([code]local_xform[/code]), the movement to test on this shape ([code]local_motion[/code]), the shape to check collisions with ([code]with_shape[/code]), the transformation matrix of that shape ([code]shape_xform[/code]), and the movement to test ont the other object ([code]shape_motion[/code]).
</description>
</method>
</methods>
@ -33055,9 +33136,10 @@ This method controls whether the position between two cached points is interpola
</description>
</method>
<methodname="to_ascii">
<returntype="String">
<returntype="RawArray">
</return>
<description>
Convert the String (which is a character array) to RawArray (which is an array of bytes). The conversion is speeded up in comparison to to_utf8() with the assumption that all the characters the String contains are only ASCII characters.
</description>
</method>
<methodname="to_float">
@ -33089,9 +33171,10 @@ This method controls whether the position between two cached points is interpola
</description>
</method>
<methodname="to_utf8">
<returntype="String">
<returntype="RawArray">
</return>
<description>
Convert the String (which is an array of characters) to RawArray (which is an array of bytes). The conversion is a bit slower than to_ascii(), but supports all UTF-8 characters. Therefore, you should prefer this function over to_ascii().
</description>
</method>
<methodname="xml_escape">
@ -33988,15 +34071,17 @@ This method controls whether the position between two cached points is interpola
@ -37404,6 +37501,14 @@ This method controls whether the position between two cached points is interpola
<description>
</description>
<methods>
<methodname="angle">
<returntype="float">
</return>
<description>
Returns the result of atan2 when called with the Vector's x and y as parameters (Math::atan2(x,y)).
Be aware that it therefore returns an angle oriented clockwise with regard to the (0, 1) unit vector, and not an angle oriented counter-clockwise with regard to the (1, 0) unit vector (which would be the typical trigonometric representation of the angle when calling Math::atan2(y,x)).
</description>
</method>
<methodname="angle_to">
<returntype="float">
</return>
@ -37422,13 +37527,6 @@ This method controls whether the position between two cached points is interpola
Returns the angle in radians between the line connecting the two points and the x coordinate.
</description>
</method>
<methodname="atan2">
<returntype="float">
</return>
<description>
Returns the result of atan2 when called with the Vector's x and y as parameters.
</description>
</method>
<methodname="cubic_interpolate">
<returntype="Vector2">
</return>
@ -37529,7 +37627,7 @@ This method controls whether the position between two cached points is interpola
<argumentindex="0"name="vec"type="Vector2">
</argument>
<description>
Reflects/mirrors the vector around another vector.
Like "slide", but reflects the Vector instead of continuing along the wall.
</description>
</method>
<methodname="rotated">
@ -37593,10 +37691,10 @@ This method controls whether the position between two cached points is interpola
@ -37605,21 +37703,21 @@ This method controls whether the position between two cached points is interpola
<argumentindex="0"name="idx"type="int">
</argument>
<description>
Get the Vector2 at the given index.
Returns the Vector2 at the given index.
</description>
</method>
<methodname="push_back">
<argumentindex="0"name="vector2"type="Vector2">
</argument>
<description>
Insert a new Vector2.
Inserts a Vector2 at the end.
</description>
</method>
<methodname="resize">
<argumentindex="0"name="idx"type="int">
</argument>
<description>
Set the size of the Vector2Array. If larger than the current size it will reserve some space beforehand, and if it is smaller it will cut off the array.
Sets the size of the Vector2Array. If larger than the current size it will reserve some space beforehand, and if it is smaller it will cut off the array.
</description>
</method>
<methodname="set">
@ -37628,7 +37726,7 @@ This method controls whether the position between two cached points is interpola
<argumentindex="1"name="vector2"type="Vector2">
</argument>
<description>
Set the Vector2 at the given index.
Changes the Vector2 at the given index.
</description>
</method>
<methodname="size">
@ -37663,12 +37761,14 @@ This method controls whether the position between two cached points is interpola
<returntype="Vector3">
</return>
<description>
Returns a new vector with all components in absolute values (e.g. positive).
</description>
</method>
<methodname="ceil">
<returntype="Vector3">
</return>
<description>
Returns a new vector with all components rounded up.
</description>
</method>
<methodname="cross">
@ -37692,7 +37792,7 @@ This method controls whether the position between two cached points is interpola
<argumentindex="3"name="t"type="float">
</argument>
<description>
Perform a cubic interpolation between vectors a,b,c,d (b is current), by the given amount (i).
Perform a cubic interpolation between vectors pre_a, a, b, post_b (a is current), by the given amount (t).
</description>
</method>
<methodname="distance_squared_to">
@ -37701,7 +37801,7 @@ This method controls whether the position between two cached points is interpola
<argumentindex="0"name="b"type="Vector3">
</argument>
<description>
Return the squared distance (distance minus the last square root) to b.
Return the squared distance (distance minus the last square root) to b. Prefer this function over distance_to if you need to sort vectors or need the squared distance for some formula.
</description>
</method>
<methodname="distance_to">
@ -37726,13 +37826,14 @@ This method controls whether the position between two cached points is interpola
<returntype="Vector3">
</return>
<description>
Returns a new vector with all components rounded down.
</description>
</method>
<methodname="inverse">
<returntype="Vector3">
</return>
<description>
Returns the inverse of the vector. this is the same as Vector3( 1.0 / v.x, 1.0 / v.y, 1.0 / v.z )
Returns the inverse of the vector. This is the same as Vector3( 1.0 / v.x, 1.0 / v.y, 1.0 / v.z )
</description>
</method>
<methodname="length">
@ -37746,7 +37847,7 @@ This method controls whether the position between two cached points is interpola
<returntype="float">
</return>
<description>
Return the length of the vector, squared.
Return the length of the vector, squared. Prefer this function over "length" if you need to sort vectors or need the squared length for some formula.
</description>
</method>
<methodname="linear_interpolate">
@ -37757,26 +37858,28 @@ This method controls whether the position between two cached points is interpola
<argumentindex="1"name="t"type="float">
</argument>
<description>
Linearly interpolates the vector to a given one (b), by the given amount (i).
Linearly interpolates the vector to a given one (b), by the given amount (t).
</description>
</method>
<methodname="max_axis">
<returntype="int">
</return>
<description>
Returns AXIS_X, AXIS_Y or AXIS_Z depending on which axis is the largest.
</description>
</method>
<methodname="min_axis">
<returntype="int">
</return>
<description>
Returns AXIS_X, AXIS_Y or AXIS_Z depending on which axis is the smallest.
</description>
</method>
<methodname="normalized">
<returntype="Vector3">
</return>
<description>
Return a copy of the normalized vector to unit length. This is the same as v / v.length()
Return a copy of the normalized vector to unit length. This is the same as v / v.length().
</description>
</method>
<methodname="reflect">
@ -37785,6 +37888,7 @@ This method controls whether the position between two cached points is interpola
<argumentindex="0"name="by"type="Vector3">
</argument>
<description>
Like "slide", but reflects the Vector instead of continuing along the wall.
</description>
</method>
<methodname="rotated">
@ -37795,6 +37899,7 @@ This method controls whether the position between two cached points is interpola
<argumentindex="1"name="phi"type="float">
</argument>
<description>
Rotates the vector around some axis by phi radians.
</description>
</method>
<methodname="slide">
@ -37803,6 +37908,7 @@ This method controls whether the position between two cached points is interpola
<argumentindex="0"name="by"type="Vector3">
</argument>
<description>
Slides the vector along a wall.
</description>
</method>
<methodname="snapped">
@ -37824,6 +37930,7 @@ This method controls whether the position between two cached points is interpola
<argumentindex="2"name="z"type="float">
</argument>
<description>
Returns a Vector3 with the given components.
</description>
</method>
</methods>
@ -37837,17 +37944,22 @@ This method controls whether the position between two cached points is interpola
</members>
<constants>
<constantname="AXIS_X"value="0">
Enumerated value for the X axis. Returned by functions like max_axis or min_axis.
@ -37856,18 +37968,21 @@ This method controls whether the position between two cached points is interpola
<argumentindex="0"name="idx"type="int">
</argument>
<description>
Returns the Vector3 at the given index.
</description>
</method>
<methodname="push_back">
<argumentindex="0"name="vector3"type="Vector3">
</argument>
<description>
Inserts a Vector3 at the end.
</description>
</method>
<methodname="resize">
<argumentindex="0"name="idx"type="int">
</argument>
<description>
Sets the size of the Vector3Array. If larger than the current size it will reserve some space beforehand, and if it is smaller it will cut off the array.
</description>
</method>
<methodname="set">
@ -37876,12 +37991,14 @@ This method controls whether the position between two cached points is interpola
<argumentindex="1"name="vector3"type="Vector3">
</argument>
<description>
Changes the Vector3 at the given index.
</description>
</method>
<methodname="size">
<returntype="int">
</return>
<description>
Returns the size of the array.
</description>
</method>
<methodname="Vector3Array">
@ -37890,6 +38007,7 @@ This method controls whether the position between two cached points is interpola
<argumentindex="0"name="from"type="Array">
</argument>
<description>
Constructs a new Vector3Array. Optionally, you can pass in an Array that will be converted.
Matrix represent a 3x3 (3 rows by 3 columns) transformation matrix. it is used mainly to represent and accumulate transformations such as rotation or scale when used as an OCS (oriented coordinate system).
</description>
<methods>
<methodname="invert">
<description>
@ -937,8 +937,8 @@
Vector used for 2D Math.
</brief_description>
<description>
</description>
Vector class, which performs basic 2D vector math operations.