Debian Codegraph @

doc/classes/PhysicsBody2D.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <class name="PhysicsBody2D" inherits="CollisionObject2D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 Abstract base class for 2D game objects affected by physics.
5 </brief_description>
6 <description>
7 [PhysicsBody2D] is an abstract base class for 2D game objects affected by physics. All 2D physics bodies inherit from it.
8 </description>
9 <tutorials>
10 <link title="Physics introduction">$DOCS_URL/tutorials/physics/physics_introduction.html</link>
11 <link title="Troubleshooting physics issues">$DOCS_URL/tutorials/physics/troubleshooting_physics_issues.html</link>
12 </tutorials>
13 <methods>
14 <method name="add_collision_exception_with">
15 <return type="void" />
16 <param index="0" name="body" type="Node" />
17 <description>
18 Adds a body to the list of bodies that this body can't collide with.
19 </description>
20 </method>
21 <method name="get_collision_exceptions">
22 <return type="PhysicsBody2D[]" />
23 <description>
24 Returns an array of nodes that were added as collision exceptions for this body.
25 </description>
26 </method>
27 <method name="get_gravity" qualifiers="const">
28 <return type="Vector2" />
29 <description>
30 Returns the gravity vector computed from all sources that can affect the body, including all gravity overrides from [Area2D] nodes and the global world gravity.
31 </description>
32 </method>
33 <method name="move_and_collide">
34 <return type="KinematicCollision2D" />
35 <param index="0" name="motion" type="Vector2" />
36 <param index="1" name="test_only" type="bool" default="false" />
37 <param index="2" name="safe_margin" type="float" default="0.08" />
38 <param index="3" name="recovery_as_collision" type="bool" default="false" />
39 <description>
40 Moves the body along the vector [param motion]. In order to be frame rate independent in [method Node._physics_process] or [method Node._process], [param motion] should be computed using [code]delta[/code].
41 Returns a [KinematicCollision2D], which contains information about the collision when stopped, or when touching another body along the motion.
42 If [param test_only] is [code]true[/code], the body does not move but the would-be collision information is given.
43 [param safe_margin] is the extra margin used for collision recovery (see [member CharacterBody2D.safe_margin] for more details).
44 If [param recovery_as_collision] is [code]true[/code], any depenetration from the recovery phase is also reported as a collision; this is used e.g. by [CharacterBody2D] for improving floor detection during floor snapping.
45 </description>
46 </method>
47 <method name="remove_collision_exception_with">
48 <return type="void" />
49 <param index="0" name="body" type="Node" />
50 <description>
51 Removes a body from the list of bodies that this body can't collide with.
52 </description>
53 </method>
54 <method name="test_move" keywords="check, collision, sweep">
55 <return type="bool" />
56 <param index="0" name="from" type="Transform2D" />
57 <param index="1" name="motion" type="Vector2" />
58 <param index="2" name="collision" type="KinematicCollision2D" default="null" />
59 <param index="3" name="safe_margin" type="float" default="0.08" />
60 <param index="4" name="recovery_as_collision" type="bool" default="false" />
61 <description>
62 Checks for collisions without moving the body. In order to be frame rate independent in [method Node._physics_process] or [method Node._process], [param motion] should be computed using [code]delta[/code].
63 Virtually sets the node's position, scale and rotation to that of the given [Transform2D], then tries to move the body along the vector [param motion]. Returns [code]true[/code] if a collision would stop the body from moving along the whole path.
64 [param collision] is an optional object of type [KinematicCollision2D], which contains additional information about the collision when stopped, or when touching another body along the motion.
65 [param safe_margin] is the extra margin used for collision recovery (see [member CharacterBody2D.safe_margin] for more details).
66 If [param recovery_as_collision] is [code]true[/code], any depenetration from the recovery phase is also reported as a collision; this is useful for checking whether the body would [i]touch[/i] any other bodies.
67 </description>
68 </method>
69 </methods>
70 <members>
71 <member name="input_pickable" type="bool" setter="set_pickable" getter="is_pickable" overrides="CollisionObject2D" default="false" />
72 </members>
73 </class>