Document new KinematicCollision2D class

This commit is contained in:
Chris Bradfield 2017-09-14 16:04:36 -07:00
parent d3c1f2a7f6
commit 33da7b4913
2 changed files with 16 additions and 1 deletions

View File

@ -63,6 +63,7 @@
<argument index="0" name="rel_vec" type="Vector2"> <argument index="0" name="rel_vec" type="Vector2">
</argument> </argument>
<description> <description>
Moves the body along the given vector. The body will stop if it collides. Returns a [KinematicCollision2D], which contains information about the colliding body.
</description> </description>
</method> </method>
<method name="move_and_slide"> <method name="move_and_slide">
@ -97,7 +98,7 @@
<argument index="1" name="rel_vec" type="Vector2"> <argument index="1" name="rel_vec" type="Vector2">
</argument> </argument>
<description> <description>
Return true if there would be a collision if the body moved from the given point in the given direction. Returns true if there would be a collision if the body moved from the given point in the given direction.
</description> </description>
</method> </method>
</methods> </methods>

View File

@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="KinematicCollision2D" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> <class name="KinematicCollision2D" inherits="Reference" category="Core" version="3.0.alpha.custom_build">
<brief_description> <brief_description>
Collision data for KinematicBody2D collisions.
</brief_description> </brief_description>
<description> <description>
Contains collision data for KinematicBody2D collisions. When a [KinematicBody2D] is moved using [method KinematicBody2D.move_and_collide], it stops if it detects a collision with another body. If a collision is detected, a KinematicCollision2D object is returned.
This object contains information about the collision, including the colliding object, the remaining motion, and the collision position. This information can be used to calculate a collision response.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
@ -78,26 +81,37 @@
</methods> </methods>
<members> <members>
<member name="collider" type="Object" setter="" getter="get_collider"> <member name="collider" type="Object" setter="" getter="get_collider">
The colliding body.
</member> </member>
<member name="collider_id" type="int" setter="" getter="get_collider_id"> <member name="collider_id" type="int" setter="" getter="get_collider_id">
The colliding body's unique [RID].
</member> </member>
<member name="collider_metadata" type="Variant" setter="" getter="get_collider_metadata"> <member name="collider_metadata" type="Variant" setter="" getter="get_collider_metadata">
The colliding body's metadata. See [Object].
</member> </member>
<member name="collider_shape" type="Object" setter="" getter="get_collider_shape"> <member name="collider_shape" type="Object" setter="" getter="get_collider_shape">
The colliding body's shape.
</member> </member>
<member name="collider_shape_index" type="int" setter="" getter="get_collider_shape_index"> <member name="collider_shape_index" type="int" setter="" getter="get_collider_shape_index">
The colliding shape's index. See [CollisionObject2D].
</member> </member>
<member name="collider_velocity" type="Vector2" setter="" getter="get_collider_velocity"> <member name="collider_velocity" type="Vector2" setter="" getter="get_collider_velocity">
The colliding object's velocity.
</member> </member>
<member name="local_shape" type="Object" setter="" getter="get_local_shape"> <member name="local_shape" type="Object" setter="" getter="get_local_shape">
The moving object's colliding shape.
</member> </member>
<member name="normal" type="Vector2" setter="" getter="get_normal"> <member name="normal" type="Vector2" setter="" getter="get_normal">
The colliding body's shape's normal at the point of collision.
</member> </member>
<member name="position" type="Vector2" setter="" getter="get_position"> <member name="position" type="Vector2" setter="" getter="get_position">
The point of collision.
</member> </member>
<member name="remainder" type="Vector2" setter="" getter="get_remainder"> <member name="remainder" type="Vector2" setter="" getter="get_remainder">
The moving object's remaining movement vector.
</member> </member>
<member name="travel" type="Vector2" setter="" getter="get_travel"> <member name="travel" type="Vector2" setter="" getter="get_travel">
The distance the moving object traveled before collision.
</member> </member>
</members> </members>
<constants> <constants>