2017-09-13 04:42:36 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2019-04-01 18:33:56 +08:00
<class name= "CollisionObject2D" inherits= "Node2D" category= "Core" version= "3.2" >
2017-09-13 04:42:36 +08:00
<brief_description >
2017-09-24 10:47:13 +08:00
Base node for 2D collision objects.
2017-09-13 04:42:36 +08:00
</brief_description>
<description >
2017-10-21 18:33:50 +08:00
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.
2017-09-13 04:42:36 +08:00
</description>
<tutorials >
</tutorials>
<methods >
<method name= "_input_event" qualifiers= "virtual" >
<return type= "void" >
</return>
<argument index= "0" name= "viewport" type= "Object" >
</argument>
<argument index= "1" name= "event" type= "InputEvent" >
</argument>
<argument index= "2" name= "shape_idx" type= "int" >
</argument>
<description >
2017-12-08 03:17:08 +08:00
Accepts unhandled [InputEvent]s. [code]shape_idx[/code] is the child index of the clicked [Shape2D]. Connect to the [code]input_event[/code] signal to easily pick up these events.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "create_shape_owner" >
<return type= "int" >
</return>
<argument index= "0" name= "owner" type= "Object" >
</argument>
<description >
2017-09-24 10:47:13 +08:00
Creates a new shape owner for the given object. Returns [code]owner_id[/code] of the new owner for future reference.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "get_rid" qualifiers= "const" >
<return type= "RID" >
</return>
<description >
2017-09-24 10:47:13 +08:00
Returns the object's [RID].
2017-09-13 04:42:36 +08:00
</description>
</method>
2019-01-27 05:21:53 +08:00
<method name= "get_shape_owner_one_way_collision_margin" qualifiers= "const" >
<return type= "float" >
</return>
<argument index= "0" name= "owner_id" type= "int" >
</argument>
<description >
</description>
</method>
2017-09-13 04:42:36 +08:00
<method name= "get_shape_owners" >
<return type= "Array" >
</return>
<description >
2017-09-24 10:47:13 +08:00
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.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "is_shape_owner_disabled" qualifiers= "const" >
<return type= "bool" >
</return>
<argument index= "0" name= "owner_id" type= "int" >
</argument>
<description >
2018-12-20 20:46:54 +08:00
If [code]true[/code], the shape owner and its shapes are disabled.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "is_shape_owner_one_way_collision_enabled" qualifiers= "const" >
<return type= "bool" >
</return>
<argument index= "0" name= "owner_id" type= "int" >
</argument>
<description >
2019-03-30 06:37:35 +08:00
Returns [code]true[/code] if collisions for the shape owner originating from this [CollisionObject2D] will not be reported to collided with [CollisionObject2D]s.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "remove_shape_owner" >
<return type= "void" >
</return>
<argument index= "0" name= "owner_id" type= "int" >
</argument>
<description >
2017-09-24 10:47:13 +08:00
Removes the given shape owner.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_find_owner" qualifiers= "const" >
<return type= "int" >
</return>
<argument index= "0" name= "shape_index" type= "int" >
</argument>
<description >
2017-09-24 10:47:13 +08:00
Returns the [code]owner_id[/code] of the given shape.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_add_shape" >
<return type= "void" >
</return>
<argument index= "0" name= "owner_id" type= "int" >
</argument>
<argument index= "1" name= "shape" type= "Shape2D" >
</argument>
<description >
2017-09-24 10:47:13 +08:00
Adds a [Shape2D] to the shape owner.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_clear_shapes" >
<return type= "void" >
</return>
<argument index= "0" name= "owner_id" type= "int" >
</argument>
<description >
2017-09-24 10:47:13 +08:00
Removes all shapes from the shape owner.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_get_owner" qualifiers= "const" >
<return type= "Object" >
</return>
<argument index= "0" name= "owner_id" type= "int" >
</argument>
<description >
2017-09-24 10:47:13 +08:00
Returns the parent object of the given shape owner.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_get_shape" qualifiers= "const" >
<return type= "Shape2D" >
</return>
<argument index= "0" name= "owner_id" type= "int" >
</argument>
<argument index= "1" name= "shape_id" type= "int" >
</argument>
<description >
2017-09-24 10:47:13 +08:00
Returns the [Shape2D] with the given id from the given shape owner.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_get_shape_count" qualifiers= "const" >
<return type= "int" >
</return>
<argument index= "0" name= "owner_id" type= "int" >
</argument>
<description >
2017-09-24 10:47:13 +08:00
Returns the number of shapes the given shape owner contains.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_get_shape_index" qualifiers= "const" >
<return type= "int" >
</return>
<argument index= "0" name= "owner_id" type= "int" >
</argument>
<argument index= "1" name= "shape_id" type= "int" >
</argument>
<description >
2017-12-08 03:17:08 +08:00
Returns the child index of the [Shape2D] with the given id from the given shape owner.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_get_transform" qualifiers= "const" >
<return type= "Transform2D" >
</return>
<argument index= "0" name= "owner_id" type= "int" >
</argument>
<description >
2017-09-24 10:47:13 +08:00
Returns the shape owner's [Transform2D].
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_remove_shape" >
<return type= "void" >
</return>
<argument index= "0" name= "owner_id" type= "int" >
</argument>
<argument index= "1" name= "shape_id" type= "int" >
</argument>
<description >
2017-09-24 10:47:13 +08:00
Removes a shape from the given shape owner.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_set_disabled" >
<return type= "void" >
</return>
<argument index= "0" name= "owner_id" type= "int" >
</argument>
<argument index= "1" name= "disabled" type= "bool" >
</argument>
<description >
2018-12-20 20:46:54 +08:00
If [code]true[/code], disables the given shape owner.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "shape_owner_set_one_way_collision" >
<return type= "void" >
</return>
<argument index= "0" name= "owner_id" type= "int" >
</argument>
<argument index= "1" name= "enable" type= "bool" >
</argument>
<description >
2019-03-30 06:37:35 +08:00
If [code]enable[/code] is [code]true[/code], collisions for the shape owner originating from this [CollisionObject2D] will not be reported to collided with [CollisionObject2D]s.
2017-09-13 04:42:36 +08:00
</description>
</method>
2019-01-27 05:21:53 +08:00
<method name= "shape_owner_set_one_way_collision_margin" >
<return type= "void" >
</return>
<argument index= "0" name= "owner_id" type= "int" >
</argument>
<argument index= "1" name= "margin" type= "float" >
</argument>
<description >
</description>
</method>
2017-09-13 04:42:36 +08:00
<method name= "shape_owner_set_transform" >
<return type= "void" >
</return>
<argument index= "0" name= "owner_id" type= "int" >
</argument>
<argument index= "1" name= "transform" type= "Transform2D" >
</argument>
<description >
2017-09-24 10:47:13 +08:00
Sets the [Transform2D] of the given shape owner.
2017-09-13 04:42:36 +08:00
</description>
</method>
</methods>
<members >
2019-06-29 18:38:01 +08:00
<member name= "input_pickable" type= "bool" setter= "set_pickable" getter= "is_pickable" default= "true" >
2019-05-02 21:43:28 +08:00
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. Requires at least one [code]collision_layer[/code] bit to be set.
2017-09-13 04:42:36 +08:00
</member>
</members>
<signals >
<signal name= "input_event" >
2018-09-01 18:05:51 +08:00
<argument index= "0" name= "viewport" type= "Node" >
2017-09-13 04:42:36 +08:00
</argument>
2018-09-01 03:12:35 +08:00
<argument index= "1" name= "event" type= "InputEvent" >
2017-09-13 04:42:36 +08:00
</argument>
<argument index= "2" name= "shape_idx" type= "int" >
</argument>
<description >
2019-05-02 21:43:28 +08:00
Emitted when an input event occurs. Requires [code]input_pickable[/code] to be [code]true[/code] and at least one [code]collision_layer[/code] bit to be set. See [method _input_event] for details.
2017-09-13 04:42:36 +08:00
</description>
</signal>
<signal name= "mouse_entered" >
<description >
2019-05-02 21:43:28 +08:00
Emitted when the mouse pointer enters any of this object's shapes. Requires [code]input_pickable[/code] to be [code]true[/code] and at least one [code]collision_layer[/code] bit to be set.
2017-09-13 04:42:36 +08:00
</description>
</signal>
<signal name= "mouse_exited" >
<description >
2019-05-02 21:43:28 +08:00
Emitted when the mouse pointer exits all this object's shapes. Requires [code]input_pickable[/code] to be [code]true[/code] and at least one [code]collision_layer[/code] bit to be set.
2017-09-13 04:42:36 +08:00
</description>
</signal>
</signals>
<constants >
</constants>
</class>