.. 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_CollisionShape2D:

CollisionShape2D
================

**Inherits:** :ref:`Node2D<class_node2d>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`

**Category:** Core

Brief Description
-----------------

Editor-only class for easy editing of shapes.

Member Functions
----------------

+------------------------------+---------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>`        | :ref:`get_collision_object_shape_index<class_CollisionShape2D_get_collision_object_shape_index>`  **(** **)** const |
+------------------------------+---------------------------------------------------------------------------------------------------------------------+
| :ref:`Object<class_object>`  | :ref:`get_shape<class_CollisionShape2D_get_shape>`  **(** **)** const                                               |
+------------------------------+---------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>`      | :ref:`is_trigger<class_CollisionShape2D_is_trigger>`  **(** **)** const                                             |
+------------------------------+---------------------------------------------------------------------------------------------------------------------+
| void                         | :ref:`set_shape<class_CollisionShape2D_set_shape>`  **(** :ref:`Object<class_object>` shape  **)**                  |
+------------------------------+---------------------------------------------------------------------------------------------------------------------+
| void                         | :ref:`set_trigger<class_CollisionShape2D_set_trigger>`  **(** :ref:`bool<class_bool>` enable  **)**                 |
+------------------------------+---------------------------------------------------------------------------------------------------------------------+

Description
-----------

Editor-only class. This is not present when running the game. It's used in the editor to properly edit and position collision shapes in :ref:`CollisionObject2D<class_collisionobject2d>`. This is not accessible from regular code.

Member Function Description
---------------------------

.. _class_CollisionShape2D_get_collision_object_shape_index:

- :ref:`int<class_int>`  **get_collision_object_shape_index**  **(** **)** const

Return the index of this shape inside its container :ref:`CollisionObject2D<class_collisionobject2d>`. This can be used to directly access the underlying :ref:`Shape2D<class_shape2d>`.

.. _class_CollisionShape2D_get_shape:

- :ref:`Object<class_object>`  **get_shape**  **(** **)** const

Return this shape's :ref:`Shape2D<class_shape2d>`.

.. _class_CollisionShape2D_is_trigger:

- :ref:`bool<class_bool>`  **is_trigger**  **(** **)** const

Return whether this shape is a trigger.

.. _class_CollisionShape2D_set_shape:

- void  **set_shape**  **(** :ref:`Object<class_object>` shape  **)**

Set this shape's :ref:`Shape2D<class_shape2d>`. This will not appear as a node, but can be directly edited as a property.

.. _class_CollisionShape2D_set_trigger:

- void  **set_trigger**  **(** :ref:`bool<class_bool>` enable  **)**

Set whether this shape is a trigger. A trigger shape detects collisions, but is otherwise unaffected by physics (i.e. will not block movement of colliding objects).


