.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead. .. _class_CollisionObject2D: CollisionObject2D ================= **Inherits:** :ref:`Node2D` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` **Inherited By:** :ref:`Area2D`, :ref:`PhysicsBody2D` **Category:** Core Brief Description ----------------- Base node for 2D collisionables. Member Functions ---------------- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`_input_event` **(** :ref:`Object` viewport, :ref:`InputEvent` event, :ref:`int` shape_idx **)** virtual | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`create_shape_owner` **(** :ref:`Object` owner **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`RID` | :ref:`get_rid` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`get_shape_owners` **(** **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_pickable` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_shape_owner_disabled` **(** :ref:`int` owner_id **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_shape_owner_one_way_collision_enabled` **(** :ref:`int` owner_id **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`remove_shape_owner` **(** :ref:`int` owner_id **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_pickable` **(** :ref:`bool` enabled **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`shape_find_owner` **(** :ref:`int` shape_index **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`shape_owner_add_shape` **(** :ref:`int` owner_id, :ref:`Shape2D` shape **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`shape_owner_clear_shapes` **(** :ref:`int` owner_id **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Object` | :ref:`shape_owner_get_owner` **(** :ref:`int` owner_id **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Shape2D` | :ref:`shape_owner_get_shape` **(** :ref:`int` owner_id, :ref:`int` shape_id **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`shape_owner_get_shape_count` **(** :ref:`int` owner_id **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`shape_owner_get_shape_index` **(** :ref:`int` owner_id, :ref:`int` shape_id **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`shape_owner_get_transform` **(** :ref:`int` owner_id **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`shape_owner_remove_shape` **(** :ref:`int` owner_id, :ref:`int` shape_id **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`shape_owner_set_disabled` **(** :ref:`int` owner_id, :ref:`bool` disabled **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`shape_owner_set_one_way_collision` **(** :ref:`int` owner_id, :ref:`bool` enable **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`shape_owner_set_transform` **(** :ref:`int` owner_id, :ref:`Transform2D` transform **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Signals ------- - **input_event** **(** :ref:`Object` viewport, :ref:`InputEvent` event, :ref:`int` shape_idx **)** This signal triggers when an input event fires over a shape. The first parameter is the viewport where the event took place. The second holds the input event received, and the third the shape of this object where it happened. - **mouse_enter** **(** **)** This event fires only once when the mouse pointer enters any shape of this object. - **mouse_exit** **(** **)** This event fires only once when the mouse pointer exits all shapes of this object. 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 :ref:`CollisionShape2D` and/or :ref:`CollisionPolygon2D` nodes as children. Such nodes are for reference and not present outside the editor, so code should use the regular shape API. Member Function Description --------------------------- .. _class_CollisionObject2D__input_event: - void **_input_event** **(** :ref:`Object` viewport, :ref:`InputEvent` event, :ref:`int` shape_idx **)** virtual .. _class_CollisionObject2D_create_shape_owner: - :ref:`int` **create_shape_owner** **(** :ref:`Object` owner **)** Creates new holder for the shapes. Argument is a :ref:`CollisionShape2D` node. It will return owner_id which usually you will want to save for later use. .. _class_CollisionObject2D_get_rid: - :ref:`RID` **get_rid** **(** **)** const Return the RID of this object. .. _class_CollisionObject2D_get_shape_owners: - :ref:`Array` **get_shape_owners** **(** **)** 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. .. _class_CollisionObject2D_is_pickable: - :ref:`bool` **is_pickable** **(** **)** const Return whether this object is pickable. .. _class_CollisionObject2D_is_shape_owner_disabled: - :ref:`bool` **is_shape_owner_disabled** **(** :ref:`int` owner_id **)** const .. _class_CollisionObject2D_is_shape_owner_one_way_collision_enabled: - :ref:`bool` **is_shape_owner_one_way_collision_enabled** **(** :ref:`int` owner_id **)** const .. _class_CollisionObject2D_remove_shape_owner: - void **remove_shape_owner** **(** :ref:`int` owner_id **)** .. _class_CollisionObject2D_set_pickable: - void **set_pickable** **(** :ref:`bool` enabled **)** Set whether this object is pickable. A pickable object can detect the mouse pointer enter/leave it and, if the mouse is inside it, report input events. .. _class_CollisionObject2D_shape_find_owner: - :ref:`int` **shape_find_owner** **(** :ref:`int` shape_index **)** const .. _class_CollisionObject2D_shape_owner_add_shape: - void **shape_owner_add_shape** **(** :ref:`int` owner_id, :ref:`Shape2D` shape **)** .. _class_CollisionObject2D_shape_owner_clear_shapes: - void **shape_owner_clear_shapes** **(** :ref:`int` owner_id **)** Will remove all the shapes associated with given owner. .. _class_CollisionObject2D_shape_owner_get_owner: - :ref:`Object` **shape_owner_get_owner** **(** :ref:`int` owner_id **)** const .. _class_CollisionObject2D_shape_owner_get_shape: - :ref:`Shape2D` **shape_owner_get_shape** **(** :ref:`int` owner_id, :ref:`int` shape_id **)** const Will return a :ref:`Shape2D`. First argument owner_id is an integer that can be obtained from :ref:`get_shape_owners`. Shape_id is a position of the shape inside owner; it's a value in range from 0 to :ref:`shape_owner_get_shape_count`. .. _class_CollisionObject2D_shape_owner_get_shape_count: - :ref:`int` **shape_owner_get_shape_count** **(** :ref:`int` owner_id **)** const Returns number of shapes to which given owner is associated to. .. _class_CollisionObject2D_shape_owner_get_shape_index: - :ref:`int` **shape_owner_get_shape_index** **(** :ref:`int` owner_id, :ref:`int` shape_id **)** const .. _class_CollisionObject2D_shape_owner_get_transform: - :ref:`Transform2D` **shape_owner_get_transform** **(** :ref:`int` owner_id **)** const Will return :ref:`Transform2D` of an owner node. .. _class_CollisionObject2D_shape_owner_remove_shape: - void **shape_owner_remove_shape** **(** :ref:`int` owner_id, :ref:`int` shape_id **)** Removes related shape from the owner. .. _class_CollisionObject2D_shape_owner_set_disabled: - void **shape_owner_set_disabled** **(** :ref:`int` owner_id, :ref:`bool` disabled **)** .. _class_CollisionObject2D_shape_owner_set_one_way_collision: - void **shape_owner_set_one_way_collision** **(** :ref:`int` owner_id, :ref:`bool` enable **)** .. _class_CollisionObject2D_shape_owner_set_transform: - void **shape_owner_set_transform** **(** :ref:`int` owner_id, :ref:`Transform2D` transform **)**