class_collisionshape2d.rst 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the CollisionShape2D.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_CollisionShape2D:
  6. CollisionShape2D
  7. ================
  8. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. Node that represents collision shape data in 2D space.
  10. Description
  11. -----------
  12. Editor facility for creating and editing collision shapes in 2D space. You can use this node to represent all sorts of collision shapes, for example, add this to an :ref:`Area2D<class_Area2D>` to give it a detection shape, or add it to a :ref:`PhysicsBody2D<class_PhysicsBody2D>` to create a solid object. **IMPORTANT**: this is an Editor-only helper to create shapes, use :ref:`CollisionObject2D.shape_owner_get_shape<class_CollisionObject2D_method_shape_owner_get_shape>` to get the actual shape.
  13. Tutorials
  14. ---------
  15. - :doc:`../tutorials/physics/physics_introduction`
  16. Properties
  17. ----------
  18. +-------------------------------+-------------------------------------------------------------------------------------------+-----------+
  19. | :ref:`bool<class_bool>` | :ref:`disabled<class_CollisionShape2D_property_disabled>` | ``false`` |
  20. +-------------------------------+-------------------------------------------------------------------------------------------+-----------+
  21. | :ref:`bool<class_bool>` | :ref:`one_way_collision<class_CollisionShape2D_property_one_way_collision>` | ``false`` |
  22. +-------------------------------+-------------------------------------------------------------------------------------------+-----------+
  23. | :ref:`float<class_float>` | :ref:`one_way_collision_margin<class_CollisionShape2D_property_one_way_collision_margin>` | ``1.0`` |
  24. +-------------------------------+-------------------------------------------------------------------------------------------+-----------+
  25. | :ref:`Shape2D<class_Shape2D>` | :ref:`shape<class_CollisionShape2D_property_shape>` | |
  26. +-------------------------------+-------------------------------------------------------------------------------------------+-----------+
  27. Property Descriptions
  28. ---------------------
  29. .. _class_CollisionShape2D_property_disabled:
  30. - :ref:`bool<class_bool>` **disabled**
  31. +-----------+---------------------+
  32. | *Default* | ``false`` |
  33. +-----------+---------------------+
  34. | *Setter* | set_disabled(value) |
  35. +-----------+---------------------+
  36. | *Getter* | is_disabled() |
  37. +-----------+---------------------+
  38. A disabled collision shape has no effect in the world. This property should be changed with :ref:`Object.set_deferred<class_Object_method_set_deferred>`.
  39. ----
  40. .. _class_CollisionShape2D_property_one_way_collision:
  41. - :ref:`bool<class_bool>` **one_way_collision**
  42. +-----------+--------------------------------+
  43. | *Default* | ``false`` |
  44. +-----------+--------------------------------+
  45. | *Setter* | set_one_way_collision(value) |
  46. +-----------+--------------------------------+
  47. | *Getter* | is_one_way_collision_enabled() |
  48. +-----------+--------------------------------+
  49. Sets whether this collision shape should only detect collision on one side (top or bottom).
  50. ----
  51. .. _class_CollisionShape2D_property_one_way_collision_margin:
  52. - :ref:`float<class_float>` **one_way_collision_margin**
  53. +-----------+-------------------------------------+
  54. | *Default* | ``1.0`` |
  55. +-----------+-------------------------------------+
  56. | *Setter* | set_one_way_collision_margin(value) |
  57. +-----------+-------------------------------------+
  58. | *Getter* | get_one_way_collision_margin() |
  59. +-----------+-------------------------------------+
  60. The margin used for one-way collision (in pixels). Higher values will make the shape thicker, and work better for colliders that enter the shape at a high velocity.
  61. ----
  62. .. _class_CollisionShape2D_property_shape:
  63. - :ref:`Shape2D<class_Shape2D>` **shape**
  64. +----------+------------------+
  65. | *Setter* | set_shape(value) |
  66. +----------+------------------+
  67. | *Getter* | get_shape() |
  68. +----------+------------------+
  69. The actual shape owned by this collision shape.
  70. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  71. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  72. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`