Physics 2D Server is the server responsible for all 2D physics. It can create many kinds of physics objects, but does not insert them on the node tree.
Add a shape to the area, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index.
</description>
</method>
<methodname="area_attach_object_instance_id">
<returntype="void">
</return>
<argumentindex="0"name="area"type="RID">
</argument>
<argumentindex="1"name="id"type="int">
</argument>
<description>
Assign the area to a descendant of [Object], so it can exist in the node tree.
</description>
</method>
<methodname="area_clear_shapes">
<returntype="void">
</return>
<argumentindex="0"name="area"type="RID">
</argument>
<description>
Remove all shapes from an area. It does not delete the shapes, so they can be reassigned later.
Remove a shape from an area. It does not delete the shape, so it can be reassigned later.
</description>
</method>
<methodname="area_set_collision_layer">
<returntype="void">
</return>
<argumentindex="0"name="area"type="RID">
</argument>
<argumentindex="1"name="layer"type="int">
</argument>
<description>
Assign the area to one or many physics layers.
</description>
</method>
<methodname="area_set_collision_mask">
<returntype="void">
</return>
<argumentindex="0"name="area"type="RID">
</argument>
<argumentindex="1"name="mask"type="int">
</argument>
<description>
Set which physics layers the area will monitor.
</description>
</method>
<methodname="area_set_monitor_callback">
<returntype="void">
</return>
<argumentindex="0"name="area"type="RID">
</argument>
<argumentindex="1"name="receiver"type="Object">
</argument>
<argumentindex="2"name="method"type="String">
</argument>
<description>
Set the function to call when any body/area enters or exits the area. This callback will be called for any object interacting with the area, and takes five parameters:
1: AREA_BODY_ADDED or AREA_BODY_REMOVED, depending on whether the object entered or exited the area.
2: [RID] of the object that entered/exited the area.
3: Instance ID of the object that entered/exited the area.
4: The shape index of the object that entered/exited the area.
5: The shape index of the area where the object entered/exited.
Add a body to the list of bodies exempt from collisions.
</description>
</method>
<methodname="body_add_force">
<returntype="void">
</return>
<argumentindex="0"name="body"type="RID">
</argument>
<argumentindex="1"name="offset"type="Vector2">
</argument>
<argumentindex="2"name="force"type="Vector2">
</argument>
<description>
Add a positioned force to the applied force and torque. As with [method body_apply_impulse], both the force and the offset from the body origin are in global coordinates. A force differs from an impulse in that, while the two are forces, the impulse clears itself after being applied.
Add a shape to the body, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index.
Create a physics body. The first parameter can be any value from constants BODY_MODE*, for the type of body created. Additionally, the body can be created in sleeping state to save processing time.
Set the function used to calculate physics for an object, if that object allows it (see [method body_set_omit_force integration]).
</description>
</method>
<methodname="body_set_max_contacts_reported">
<returntype="void">
</return>
<argumentindex="0"name="body"type="RID">
</argument>
<argumentindex="1"name="amount"type="int">
</argument>
<description>
Set the maximum contacts to report. Bodies can keep a log of the contacts with other bodies, this is enabled by setting the maximum amount of contacts reported to a number greater than 0.
Return whether a body can move from a given point in a given direction. Apart from the boolean return value, a [Physics2DTestMotionResult] can be passed to return additional information in.
</description>
</method>
<methodname="damped_spring_joint_create">
<returntype="RID">
</return>
<argumentindex="0"name="anchor_a"type="Vector2">
</argument>
<argumentindex="1"name="anchor_b"type="Vector2">
</argument>
<argumentindex="2"name="body_a"type="RID">
</argument>
<argumentindex="3"name="body_b"type="RID">
</argument>
<description>
Create a damped spring joint between two bodies. If not specified, the second body is assumed to be the joint itself.
Set a damped spring joint parameter. Parameters are explained in the DAMPED_STRING* constants.
</description>
</method>
<methodname="free_rid">
<returntype="void">
</return>
<argumentindex="0"name="rid"type="RID">
</argument>
<description>
Destroy any of the objects created by Physics2DServer. If the [RID] passed is not one of the objects that can be created by Physics2DServer, an error will be sent to the console.
Set the shape data that defines its shape and size. The data to be passed depends on the kind of shape created [method shape_get_type].
</description>
</method>
<methodname="space_create">
<returntype="RID">
</return>
<description>
Create a space. A space is a collection of parameters for the physics engine that can be assigned to an area or a body. It can be assigned to an area with [method area_set_space], or to a body with [method body_set_space].
</description>
</method>
<methodname="space_get_direct_state">
<returntype="Physics2DDirectSpaceState">
</return>
<argumentindex="0"name="space"type="RID">
</argument>
<description>
Return the state of a space, a [Physics2DDirectSpaceState]. This object can be used to make collision/intersection queries.
Constant to set/get the maximum time of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after this time.
Constant to set/get the default solver bias for all physics constraints. A solver bias is a factor controlling how much two objects "rebound", after violating a constraint, to avoid leaving them in that state because of numerical imprecision.
</constant>
<constantname="SHAPE_LINE"value="0">
This is the constant for creating line shapes. A line shape is an infinite line with an origin point, and a normal. Thus, it can be used for front/behind checks.
</constant>
<constantname="SHAPE_SEGMENT"value="2">
This is the constant for creating segment shapes. A segment shape is a line from a point A to a point B. It can be checked for intersections.
</constant>
<constantname="SHAPE_CIRCLE"value="3">
This is the constant for creating circle shapes. A circle shape only has a radius. It can be used for intersections and inside/outside checks.
</constant>
<constantname="SHAPE_RECTANGLE"value="4">
This is the constant for creating rectangle shapes. A rectangle shape is defined by a width and a height. It can be used for intersections and inside/outside checks.
</constant>
<constantname="SHAPE_CAPSULE"value="5">
This is the constant for creating capsule shapes. A capsule shape is defined by a radius and a length. It can be used for intersections and inside/outside checks.
</constant>
<constantname="SHAPE_CONVEX_POLYGON"value="6">
This is the constant for creating convex polygon shapes. A polygon is defined by a list of points. It can be used for intersections and inside/outside checks. Unlike the method [method CollisionPolygon2D.set_polygon], polygons modified with [method shape_set_data] do not verify that the points supplied form, in fact, a convex polygon.
</constant>
<constantname="SHAPE_CONCAVE_POLYGON"value="7">
This is the constant for creating concave polygon shapes. A polygon is defined by a list of points. It can be used for intersections checks, but not for inside/outside checks.
</constant>
<constantname="SHAPE_CUSTOM"value="8">
This constant is used internally by the engine. Any attempt to create this kind of shape results in an error.
Constant to set/get the falloff factor for point gravity of an area. The greater this value is, the faster the strength of gravity decreases with the square of distance.
This area adds its gravity/damp values to whatever has been calculated so far. This way, many overlapping areas can combine their physics to make interesting effects.
This area adds its gravity/damp values to whatever has been calculated so far. Then stops taking into account the rest of the areas, even the default one.
Set the resting length of the spring joint. The joint will always try to go to back this length when pulled apart.
</constant>
<constantname="DAMPED_STRING_STIFFNESS"value="1">
Set the stiffness of the spring joint. The joint applies a force equal to the stiffness times the distance from its resting length.
</constant>
<constantname="DAMPED_STRING_DAMPING"value="2">
Set the damping ratio of the spring joint. A value of 0 indicates an undamped spring, while 1 causes the system to reach equilibrium as fast as possible (critical damping).
</constant>
<constantname="CCD_MODE_DISABLED"value="0">
Disables continuous collision detection. This is the fastest way to detect body collisions, but can miss small, fast-moving objects.
</constant>
<constantname="CCD_MODE_CAST_RAY"value="1">
Enables continuous collision detection by raycasting. It is faster than shapecasting, but less precise.
</constant>
<constantname="CCD_MODE_CAST_SHAPE"value="2">
Enables continuous collision detection by shapecasting. It is the slowest CCD method, and the most precise.
</constant>
<constantname="AREA_BODY_ADDED"value="0">
The value of the first parameter and area callback function receives, when an object enters one of its shapes.
</constant>
<constantname="AREA_BODY_REMOVED"value="1">
The value of the first parameter and area callback function receives, when an object exits one of its shapes.
</constant>
<constantname="INFO_ACTIVE_OBJECTS"value="0">
Constant to get the number of objects that are not sleeping.
</constant>
<constantname="INFO_COLLISION_PAIRS"value="1">
Constant to get the number of possible collisions.
</constant>
<constantname="INFO_ISLAND_COUNT"value="2">
Constant to get the number of space regions where a collision could occur.