[DOCS] Update CollisionObject/CollisionObject2D class ref

This commit is contained in:
Chris Bradfield 2017-09-23 19:47:13 -07:00
parent 3c857033df
commit 29f37120dd
2 changed files with 40 additions and 19 deletions

View file

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="CollisionObject" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> <class name="CollisionObject" inherits="Spatial" category="Core" version="3.0.alpha.custom_build">
<brief_description> <brief_description>
Base node for collision objects.
</brief_description> </brief_description>
<description> <description>
CollisionObject is the base class for physics objects. It can hold any number of collision [Shape]\ s. Each shape must be assigned to a [i]shape owner[/i]. The CollisionObject can have any number of shape owners. Shape owners are not nodes and do not appear in the editor, but are accessible through code using the [code]shape_owner_*[/code] methods.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
@ -31,7 +33,7 @@
<argument index="0" name="owner" type="Object"> <argument index="0" name="owner" type="Object">
</argument> </argument>
<description> <description>
Creates new holder for the shapes. Argument is a [CollisionShape] node. It will return owner_id which usually you will want to save for later use. Creates a new shape owner for the given object. Returns [code]owner_id[/code] of the new owner for future reference.
</description> </description>
</method> </method>
<method name="get_capture_input_on_drag" qualifiers="const"> <method name="get_capture_input_on_drag" qualifiers="const">
@ -44,13 +46,14 @@
<return type="RID"> <return type="RID">
</return> </return>
<description> <description>
Returns the object's [RID].
</description> </description>
</method> </method>
<method name="get_shape_owners"> <method name="get_shape_owners">
<return type="Array"> <return type="Array">
</return> </return>
<description> <description>
Shape owner is a node which is holding concrete shape resources. This method will return an array which is holding an integer numbers that are representing unique ID of each owner. You can use those ids when you are using others shape_owner methods. Returns an [Array] of [code]owner_id[/code] identifiers. You can use these ids in other methods that take [code]owner_id[/code] as an argument.
</description> </description>
</method> </method>
<method name="is_ray_pickable" qualifiers="const"> <method name="is_ray_pickable" qualifiers="const">
@ -65,6 +68,7 @@
<argument index="0" name="owner_id" type="int"> <argument index="0" name="owner_id" type="int">
</argument> </argument>
<description> <description>
If [code]true[/code] the shape owner and its shapes are disabled.
</description> </description>
</method> </method>
<method name="remove_shape_owner"> <method name="remove_shape_owner">
@ -73,6 +77,7 @@
<argument index="0" name="owner_id" type="int"> <argument index="0" name="owner_id" type="int">
</argument> </argument>
<description> <description>
Removes the given shape owner.
</description> </description>
</method> </method>
<method name="set_capture_input_on_drag"> <method name="set_capture_input_on_drag">
@ -97,6 +102,7 @@
<argument index="0" name="shape_index" type="int"> <argument index="0" name="shape_index" type="int">
</argument> </argument>
<description> <description>
Returns the [code]owner_id[/code] of the given shape.
</description> </description>
</method> </method>
<method name="shape_owner_add_shape"> <method name="shape_owner_add_shape">
@ -107,6 +113,7 @@
<argument index="1" name="shape" type="Shape"> <argument index="1" name="shape" type="Shape">
</argument> </argument>
<description> <description>
Adds a [Shape] to the shape owner.
</description> </description>
</method> </method>
<method name="shape_owner_clear_shapes"> <method name="shape_owner_clear_shapes">
@ -115,7 +122,7 @@
<argument index="0" name="owner_id" type="int"> <argument index="0" name="owner_id" type="int">
</argument> </argument>
<description> <description>
Will remove all the shapes associated with given owner. Removes all shapes from the shape owner.
</description> </description>
</method> </method>
<method name="shape_owner_get_owner" qualifiers="const"> <method name="shape_owner_get_owner" qualifiers="const">
@ -124,6 +131,7 @@
<argument index="0" name="owner_id" type="int"> <argument index="0" name="owner_id" type="int">
</argument> </argument>
<description> <description>
Returns the parent object of the given shape owner.
</description> </description>
</method> </method>
<method name="shape_owner_get_shape" qualifiers="const"> <method name="shape_owner_get_shape" qualifiers="const">
@ -134,7 +142,7 @@
<argument index="1" name="shape_id" type="int"> <argument index="1" name="shape_id" type="int">
</argument> </argument>
<description> <description>
Will return a [Shape]. First argument owner_id is an integer that can be obtained from [method get_shape_owners]. Shape_id is a position of the shape inside owner; it's a value in range from 0 to [method shape_owner_get_shape_count]. Returns the [Shape] with the given id from the given shape owner.
</description> </description>
</method> </method>
<method name="shape_owner_get_shape_count" qualifiers="const"> <method name="shape_owner_get_shape_count" qualifiers="const">
@ -143,7 +151,7 @@
<argument index="0" name="owner_id" type="int"> <argument index="0" name="owner_id" type="int">
</argument> </argument>
<description> <description>
Returns number of shapes to which given owner is associated to. Returns the number of shapes the given shape owner contains.
</description> </description>
</method> </method>
<method name="shape_owner_get_shape_index" qualifiers="const"> <method name="shape_owner_get_shape_index" qualifiers="const">
@ -162,7 +170,7 @@
<argument index="0" name="owner_id" type="int"> <argument index="0" name="owner_id" type="int">
</argument> </argument>
<description> <description>
Will return [Transform] of an owner node. Returns the shape owner's [Transform].
</description> </description>
</method> </method>
<method name="shape_owner_remove_shape"> <method name="shape_owner_remove_shape">
@ -173,7 +181,7 @@
<argument index="1" name="shape_id" type="int"> <argument index="1" name="shape_id" type="int">
</argument> </argument>
<description> <description>
Removes related shape from the owner. Removes a shape from the given shape owner.
</description> </description>
</method> </method>
<method name="shape_owner_set_disabled"> <method name="shape_owner_set_disabled">
@ -184,6 +192,7 @@
<argument index="1" name="disabled" type="bool"> <argument index="1" name="disabled" type="bool">
</argument> </argument>
<description> <description>
If [code]true[/code] disables the given shape owner.
</description> </description>
</method> </method>
<method name="shape_owner_set_transform"> <method name="shape_owner_set_transform">
@ -194,6 +203,7 @@
<argument index="1" name="transform" type="Transform"> <argument index="1" name="transform" type="Transform">
</argument> </argument>
<description> <description>
Sets the [Transform] of the given shape owner.
</description> </description>
</method> </method>
</methods> </methods>
@ -220,10 +230,12 @@
</signal> </signal>
<signal name="mouse_entered"> <signal name="mouse_entered">
<description> <description>
Emitted when the mouse pointer enters any of this object's shapes.
</description> </description>
</signal> </signal>
<signal name="mouse_exited"> <signal name="mouse_exited">
<description> <description>
Emitted when the mouse pointer exits all this object's shapes.
</description> </description>
</signal> </signal>
</signals> </signals>

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="CollisionObject2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> <class name="CollisionObject2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build">
<brief_description> <brief_description>
Base node for 2D collisionables. Base node for 2D collision objects.
</brief_description> </brief_description>
<description> <description>
CollisionObject2D is the base class for 2D physics collisionables. They can hold any number of 2D collision shapes. Usually, they are edited by placing [CollisionShape2D] and/or [CollisionPolygon2D] nodes as children. Such nodes are for reference and not present outside the editor, so code should use the regular shape API. CollisionObject2D is the base class for 2D physics objects. It can hold any number of 2D collision [Shape2D]\ s. Each shape must be assigned to a [i]shape owner[/i]. The CollisionObject2D can have any number of shape owners. Shape owners are not nodes and do not appear in the editor, but are accessible through code using the [code]shape_owner_*[/code] methods.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
@ -29,21 +29,21 @@
<argument index="0" name="owner" type="Object"> <argument index="0" name="owner" type="Object">
</argument> </argument>
<description> <description>
Creates new holder for the shapes. Argument is a [CollisionShape2D] node. It will return owner_id which usually you will want to save for later use. Creates a new shape owner for the given object. Returns [code]owner_id[/code] of the new owner for future reference.
</description> </description>
</method> </method>
<method name="get_rid" qualifiers="const"> <method name="get_rid" qualifiers="const">
<return type="RID"> <return type="RID">
</return> </return>
<description> <description>
Return the RID of this object. Returns the object's [RID].
</description> </description>
</method> </method>
<method name="get_shape_owners"> <method name="get_shape_owners">
<return type="Array"> <return type="Array">
</return> </return>
<description> <description>
Shape owner is a node which is holding concrete shape resources. This method will return an array which is holding an integer numbers that are representing unique ID of each owner. You can use those ids when you are using others shape_owner methods. Returns an [Array] of [code]owner_id[/code] identifiers. You can use these ids in other methods that take [code]owner_id[/code] as an argument.
</description> </description>
</method> </method>
<method name="is_pickable" qualifiers="const"> <method name="is_pickable" qualifiers="const">
@ -59,6 +59,7 @@
<argument index="0" name="owner_id" type="int"> <argument index="0" name="owner_id" type="int">
</argument> </argument>
<description> <description>
If [code]true[/code] the shape owner and its shapes are disabled.
</description> </description>
</method> </method>
<method name="is_shape_owner_one_way_collision_enabled" qualifiers="const"> <method name="is_shape_owner_one_way_collision_enabled" qualifiers="const">
@ -75,6 +76,7 @@
<argument index="0" name="owner_id" type="int"> <argument index="0" name="owner_id" type="int">
</argument> </argument>
<description> <description>
Removes the given shape owner.
</description> </description>
</method> </method>
<method name="set_pickable"> <method name="set_pickable">
@ -92,6 +94,7 @@
<argument index="0" name="shape_index" type="int"> <argument index="0" name="shape_index" type="int">
</argument> </argument>
<description> <description>
Returns the [code]owner_id[/code] of the given shape.
</description> </description>
</method> </method>
<method name="shape_owner_add_shape"> <method name="shape_owner_add_shape">
@ -102,6 +105,7 @@
<argument index="1" name="shape" type="Shape2D"> <argument index="1" name="shape" type="Shape2D">
</argument> </argument>
<description> <description>
Adds a [Shape2D] to the shape owner.
</description> </description>
</method> </method>
<method name="shape_owner_clear_shapes"> <method name="shape_owner_clear_shapes">
@ -110,7 +114,7 @@
<argument index="0" name="owner_id" type="int"> <argument index="0" name="owner_id" type="int">
</argument> </argument>
<description> <description>
Will remove all the shapes associated with given owner. Removes all shapes from the shape owner.
</description> </description>
</method> </method>
<method name="shape_owner_get_owner" qualifiers="const"> <method name="shape_owner_get_owner" qualifiers="const">
@ -119,6 +123,7 @@
<argument index="0" name="owner_id" type="int"> <argument index="0" name="owner_id" type="int">
</argument> </argument>
<description> <description>
Returns the parent object of the given shape owner.
</description> </description>
</method> </method>
<method name="shape_owner_get_shape" qualifiers="const"> <method name="shape_owner_get_shape" qualifiers="const">
@ -129,7 +134,7 @@
<argument index="1" name="shape_id" type="int"> <argument index="1" name="shape_id" type="int">
</argument> </argument>
<description> <description>
Will return a [Shape2D]. First argument owner_id is an integer that can be obtained from [method get_shape_owners]. Shape_id is a position of the shape inside owner; it's a value in range from 0 to [method shape_owner_get_shape_count]. Returns the [Shape2D] with the given id from the given shape owner.
</description> </description>
</method> </method>
<method name="shape_owner_get_shape_count" qualifiers="const"> <method name="shape_owner_get_shape_count" qualifiers="const">
@ -138,7 +143,7 @@
<argument index="0" name="owner_id" type="int"> <argument index="0" name="owner_id" type="int">
</argument> </argument>
<description> <description>
Returns number of shapes to which given owner is associated to. Returns the number of shapes the given shape owner contains.
</description> </description>
</method> </method>
<method name="shape_owner_get_shape_index" qualifiers="const"> <method name="shape_owner_get_shape_index" qualifiers="const">
@ -157,7 +162,7 @@
<argument index="0" name="owner_id" type="int"> <argument index="0" name="owner_id" type="int">
</argument> </argument>
<description> <description>
Will return [Transform2D] of an owner node. Returns the shape owner's [Transform2D].
</description> </description>
</method> </method>
<method name="shape_owner_remove_shape"> <method name="shape_owner_remove_shape">
@ -168,7 +173,7 @@
<argument index="1" name="shape_id" type="int"> <argument index="1" name="shape_id" type="int">
</argument> </argument>
<description> <description>
Removes related shape from the owner. Removes a shape from the given shape owner.
</description> </description>
</method> </method>
<method name="shape_owner_set_disabled"> <method name="shape_owner_set_disabled">
@ -179,6 +184,7 @@
<argument index="1" name="disabled" type="bool"> <argument index="1" name="disabled" type="bool">
</argument> </argument>
<description> <description>
If [code]true[/code] disables the given shape owner.
</description> </description>
</method> </method>
<method name="shape_owner_set_one_way_collision"> <method name="shape_owner_set_one_way_collision">
@ -199,11 +205,13 @@
<argument index="1" name="transform" type="Transform2D"> <argument index="1" name="transform" type="Transform2D">
</argument> </argument>
<description> <description>
Sets the [Transform2D] of the given shape owner.
</description> </description>
</method> </method>
</methods> </methods>
<members> <members>
<member name="input_pickable" type="bool" setter="set_pickable" getter="is_pickable"> <member name="input_pickable" type="bool" setter="set_pickable" getter="is_pickable">
If [code]true[/code] this object is pickable. A pickable object can detect the mouse pointer entering/leaving, and if the mouse is inside it, report input events.
</member> </member>
</members> </members>
<signals> <signals>
@ -215,16 +223,17 @@
<argument index="2" name="shape_idx" type="int"> <argument index="2" name="shape_idx" type="int">
</argument> </argument>
<description> <description>
Emitted when an input event occurs and [code]input_pickable[/code] is [code]true[/code].
</description> </description>
</signal> </signal>
<signal name="mouse_entered"> <signal name="mouse_entered">
<description> <description>
This event fires only once when the mouse pointer enters any shape of this object. Emitted when the mouse pointer enters any of this object's shapes.
</description> </description>
</signal> </signal>
<signal name="mouse_exited"> <signal name="mouse_exited">
<description> <description>
This event fires only once when the mouse pointer exits all shapes of this object. Emitted when the mouse pointer exits all this object's shapes.
</description> </description>
</signal> </signal>
</signals> </signals>