Skip to content

Commit

Permalink
Merge pull request #34222 from Calinou/doc-collisionshapes
Browse files Browse the repository at this point in the history
Improve the Shape/Shape2D classes documentation
  • Loading branch information
akien-mga authored Dec 10, 2019
2 parents 2845e6a + 16d612d commit c868baf
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 6 deletions.
1 change: 1 addition & 0 deletions doc/classes/CollisionShape2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
Sets whether this collision shape should only detect collision on one side (top or bottom).
</member>
<member name="one_way_collision_margin" type="float" setter="set_one_way_collision_margin" getter="get_one_way_collision_margin" default="1.0">
The margin used for one-way collision (in pixels).
</member>
<member name="shape" type="Shape2D" setter="set_shape" getter="get_shape">
The actual shape owned by this collision shape.
Expand Down
12 changes: 7 additions & 5 deletions doc/classes/Physics2DShapeQueryParameters.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Parameters to be sent to a 2D shape physics query.
</brief_description>
<description>
This class contains the shape and other parameters for intersection/collision queries.
This class contains the shape and other parameters for 2D intersection/collision queries. See also [Physics2DShapeQueryResult].
</description>
<tutorials>
</tutorials>
Expand All @@ -21,14 +21,16 @@
</methods>
<members>
<member name="collide_with_areas" type="bool" setter="set_collide_with_areas" getter="is_collide_with_areas_enabled" default="false">
If [code]true[/code], the query will take [Area2D]s into account.
</member>
<member name="collide_with_bodies" type="bool" setter="set_collide_with_bodies" getter="is_collide_with_bodies_enabled" default="true">
If [code]true[/code], the query will take [PhysicsBody2D]s into account.
</member>
<member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer" default="2147483647">
The physics layer the query should be made on.
The physics layer(s) the query will take into account (as a bitmask).
</member>
<member name="exclude" type="Array" setter="set_exclude" getter="get_exclude" default="[ ]">
The list of objects or object [RID]s, that will be excluded from collisions.
The list of objects or object [RID]s that will be excluded from collisions.
</member>
<member name="margin" type="float" setter="set_margin" getter="get_margin" default="0.0">
The collision margin for the shape.
Expand All @@ -37,10 +39,10 @@
The motion of the shape being queried for.
</member>
<member name="shape_rid" type="RID" setter="set_shape_rid" getter="get_shape_rid">
The [RID] of the queried shape. See also [method set_shape].
The queried shape's [RID]. See also [method set_shape].
</member>
<member name="transform" type="Transform2D" setter="set_transform" getter="get_transform" default="Transform2D( 1, 0, 0, 1, 0, 0 )">
the transform matrix of the queried shape.
The queried shape's transform matrix.
</member>
</members>
<constants>
Expand Down
7 changes: 7 additions & 0 deletions doc/classes/Physics2DShapeQueryResult.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Physics2DShapeQueryResult" inherits="Reference" category="Core" version="3.2">
<brief_description>
Result of a 2D shape query in [Physics2DServer].
</brief_description>
<description>
The result of a 2D shape query in [Physics2DServer]. See also [Physics2DShapeQueryParameters].
</description>
<tutorials>
</tutorials>
Expand All @@ -11,6 +13,7 @@
<return type="int">
</return>
<description>
Returns the number of objects that intersected with the shape.
</description>
</method>
<method name="get_result_object" qualifiers="const">
Expand All @@ -19,6 +22,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
Returns the [Object] that intersected with the shape at index [code]idx[/code].
</description>
</method>
<method name="get_result_object_id" qualifiers="const">
Expand All @@ -27,6 +31,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
Returns the instance ID of the [Object] that intersected with the shape at index [code]idx[/code].
</description>
</method>
<method name="get_result_object_shape" qualifiers="const">
Expand All @@ -35,6 +40,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
Returns the child index of the object's [Shape] that intersected with the shape at index [code]idx[/code].
</description>
</method>
<method name="get_result_rid" qualifiers="const">
Expand All @@ -43,6 +49,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
Returns the [RID] of the object that intersected with the shape at index [code]idx[/code].
</description>
</method>
</methods>
Expand Down
10 changes: 10 additions & 0 deletions doc/classes/PhysicsShapeQueryParameters.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="PhysicsShapeQueryParameters" inherits="Reference" category="Core" version="3.2">
<brief_description>
Parameters to be sent to a 3D shape physics query.
</brief_description>
<description>
This class contains the shape and other parameters for 3D intersection/collision queries. See also [PhysicsShapeQueryResult].
</description>
<tutorials>
</tutorials>
Expand All @@ -13,23 +15,31 @@
<argument index="0" name="shape" type="Resource">
</argument>
<description>
Sets the [Shape] that will be used for collision/intersection queries.
</description>
</method>
</methods>
<members>
<member name="collide_with_areas" type="bool" setter="set_collide_with_areas" getter="is_collide_with_areas_enabled" default="false">
If [code]true[/code], the query will take [Area]s into account.
</member>
<member name="collide_with_bodies" type="bool" setter="set_collide_with_bodies" getter="is_collide_with_bodies_enabled" default="true">
If [code]true[/code], the query will take [PhysicsBody]s into account.
</member>
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="2147483647">
The physics layer(s) the query will take into account (as a bitmask).
</member>
<member name="exclude" type="Array" setter="set_exclude" getter="get_exclude" default="[ ]">
The list of objects or object [RID]s that will be excluded from collisions.
</member>
<member name="margin" type="float" setter="set_margin" getter="get_margin" default="0.0">
The collision margin for the shape.
</member>
<member name="shape_rid" type="RID" setter="set_shape_rid" getter="get_shape_rid">
The queried shape's [RID]. See also [method set_shape].
</member>
<member name="transform" type="Transform" setter="set_transform" getter="get_transform" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
The queried shape's transform matrix.
</member>
</members>
<constants>
Expand Down
8 changes: 7 additions & 1 deletion doc/classes/PhysicsShapeQueryResult.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="PhysicsShapeQueryResult" inherits="Reference" category="Core" version="3.2">
<brief_description>
Result of a shape query in Physics2DServer.
Result of a 3D shape query in [PhysicsServer].
</brief_description>
<description>
The result of a 3D shape query in [PhysicsServer]. See also [PhysicsShapeQueryParameters].
</description>
<tutorials>
</tutorials>
Expand All @@ -12,6 +13,7 @@
<return type="int">
</return>
<description>
Returns the number of objects that intersected with the shape.
</description>
</method>
<method name="get_result_object" qualifiers="const">
Expand All @@ -20,6 +22,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
Returns the [Object] that intersected with the shape at index [code]idx[/code].
</description>
</method>
<method name="get_result_object_id" qualifiers="const">
Expand All @@ -28,6 +31,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
Returns the instance ID of the [Object] that intersected with the shape at index [code]idx[/code].
</description>
</method>
<method name="get_result_object_shape" qualifiers="const">
Expand All @@ -36,6 +40,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
Returns the child index of the object's [Shape] that intersected with the shape at index [code]idx[/code].
</description>
</method>
<method name="get_result_rid" qualifiers="const">
Expand All @@ -44,6 +49,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
Returns the [RID] of the object that intersected with the shape at index [code]idx[/code].
</description>
</method>
</methods>
Expand Down
3 changes: 3 additions & 0 deletions doc/classes/PlaneShape.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="PlaneShape" inherits="Shape" category="Core" version="3.2">
<brief_description>
Infinite plane shape for 3D collisions.
</brief_description>
<description>
An infinite plane shape for 3D collisions. Note that the [Plane]'s normal matters; anything "below" the plane will collide with it. If the [PlaneShape] is used in a [PhysicsBody], it will cause colliding objects placed "below" it to teleport "above" the plane.
</description>
<tutorials>
</tutorials>
<methods>
</methods>
<members>
<member name="plane" type="Plane" setter="set_plane" getter="get_plane" default="Plane( 0, 1, 0, 0 )">
The [Plane] used by the [PlaneShape] for collision.
</member>
</members>
<constants>
Expand Down
1 change: 1 addition & 0 deletions doc/classes/Shape.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</methods>
<members>
<member name="margin" type="float" setter="set_margin" getter="get_margin" default="0.04">
The collision margin for the shape.
</member>
</members>
<constants>
Expand Down
1 change: 1 addition & 0 deletions doc/classes/Shape2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
</methods>
<members>
<member name="custom_solver_bias" type="float" setter="set_custom_solver_bias" getter="get_custom_solver_bias" default="0.0">
The shape's custom solver bias.
</member>
</members>
<constants>
Expand Down

0 comments on commit c868baf

Please sign in to comment.