123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <class name="CollisionObject2D" inherits="Node2D" category="Core" version="3.1">
- <brief_description>
- Base node for 2D collision objects.
- </brief_description>
- <description>
- 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>
- <tutorials>
- </tutorials>
- <demos>
- </demos>
- <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>
- 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.
- </description>
- </method>
- <method name="create_shape_owner">
- <return type="int">
- </return>
- <argument index="0" name="owner" type="Object">
- </argument>
- <description>
- Creates a new shape owner for the given object. Returns [code]owner_id[/code] of the new owner for future reference.
- </description>
- </method>
- <method name="get_rid" qualifiers="const">
- <return type="RID">
- </return>
- <description>
- Returns the object's [RID].
- </description>
- </method>
- <method name="get_shape_owners">
- <return type="Array">
- </return>
- <description>
- 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>
- </method>
- <method name="is_shape_owner_disabled" qualifiers="const">
- <return type="bool">
- </return>
- <argument index="0" name="owner_id" type="int">
- </argument>
- <description>
- If [code]true[/code], the shape owner and its shapes are disabled.
- </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>
- Returns [code]true[/code] if collisions for the shape owner originating from this [code]CollisionObject2D[/code] will not be reported to collided with [code]CollisionObject2D[/code]s.
- </description>
- </method>
- <method name="remove_shape_owner">
- <return type="void">
- </return>
- <argument index="0" name="owner_id" type="int">
- </argument>
- <description>
- Removes the given shape owner.
- </description>
- </method>
- <method name="shape_find_owner" qualifiers="const">
- <return type="int">
- </return>
- <argument index="0" name="shape_index" type="int">
- </argument>
- <description>
- Returns the [code]owner_id[/code] of the given shape.
- </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>
- Adds a [Shape2D] to the shape owner.
- </description>
- </method>
- <method name="shape_owner_clear_shapes">
- <return type="void">
- </return>
- <argument index="0" name="owner_id" type="int">
- </argument>
- <description>
- Removes all shapes from the shape owner.
- </description>
- </method>
- <method name="shape_owner_get_owner" qualifiers="const">
- <return type="Object">
- </return>
- <argument index="0" name="owner_id" type="int">
- </argument>
- <description>
- Returns the parent object of the given shape owner.
- </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>
- Returns the [Shape2D] with the given id from the given shape owner.
- </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>
- Returns the number of shapes the given shape owner contains.
- </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>
- Returns the child index of the [Shape2D] with the given id from the given shape owner.
- </description>
- </method>
- <method name="shape_owner_get_transform" qualifiers="const">
- <return type="Transform2D">
- </return>
- <argument index="0" name="owner_id" type="int">
- </argument>
- <description>
- Returns the shape owner's [Transform2D].
- </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>
- Removes a shape from the given shape owner.
- </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>
- If [code]true[/code], disables the given shape owner.
- </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>
- If [code]enable[/code] is [code]true[/code], collisions for the shape owner originating from this [code]CollisionObject2D[/code] will not be reported to collided with [code]CollisionObject2D[/code]s.
- </description>
- </method>
- <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>
- Sets the [Transform2D] of the given shape owner.
- </description>
- </method>
- </methods>
- <members>
- <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>
- </members>
- <signals>
- <signal name="input_event">
- <argument index="0" name="viewport" type="Node">
- </argument>
- <argument index="1" name="event" type="InputEvent">
- </argument>
- <argument index="2" name="shape_idx" type="int">
- </argument>
- <description>
- Emitted when an input event occurs and [code]input_pickable[/code] is [code]true[/code]. See [method _input_event] for details.
- </description>
- </signal>
- <signal name="mouse_entered">
- <description>
- Emitted when the mouse pointer enters any of this object's shapes.
- </description>
- </signal>
- <signal name="mouse_exited">
- <description>
- Emitted when the mouse pointer exits all this object's shapes.
- </description>
- </signal>
- </signals>
- <constants>
- </constants>
- </class>
|