class_collisionshape2d.rst 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/CollisionShape2D.xml.
  6. .. _class_CollisionShape2D:
  7. CollisionShape2D
  8. ================
  9. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Node that represents collision shape data in 2D space.
  11. Description
  12. -----------
  13. 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.
  14. Tutorials
  15. ---------
  16. - :doc:`Physics introduction <../tutorials/physics/physics_introduction>`
  17. - `2D Dodge The Creeps Demo <https://godotengine.org/asset-library/asset/515>`__
  18. - `2D Pong Demo <https://godotengine.org/asset-library/asset/121>`__
  19. - `2D Kinematic Character Demo <https://godotengine.org/asset-library/asset/113>`__
  20. Properties
  21. ----------
  22. +-------------------------------+-------------------------------------------------------------------------------------------+-----------+
  23. | :ref:`bool<class_bool>` | :ref:`disabled<class_CollisionShape2D_property_disabled>` | ``false`` |
  24. +-------------------------------+-------------------------------------------------------------------------------------------+-----------+
  25. | :ref:`bool<class_bool>` | :ref:`one_way_collision<class_CollisionShape2D_property_one_way_collision>` | ``false`` |
  26. +-------------------------------+-------------------------------------------------------------------------------------------+-----------+
  27. | :ref:`float<class_float>` | :ref:`one_way_collision_margin<class_CollisionShape2D_property_one_way_collision_margin>` | ``1.0`` |
  28. +-------------------------------+-------------------------------------------------------------------------------------------+-----------+
  29. | :ref:`Shape2D<class_Shape2D>` | :ref:`shape<class_CollisionShape2D_property_shape>` | |
  30. +-------------------------------+-------------------------------------------------------------------------------------------+-----------+
  31. Property Descriptions
  32. ---------------------
  33. .. _class_CollisionShape2D_property_disabled:
  34. - :ref:`bool<class_bool>` **disabled**
  35. +-----------+---------------------+
  36. | *Default* | ``false`` |
  37. +-----------+---------------------+
  38. | *Setter* | set_disabled(value) |
  39. +-----------+---------------------+
  40. | *Getter* | is_disabled() |
  41. +-----------+---------------------+
  42. 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>`.
  43. ----
  44. .. _class_CollisionShape2D_property_one_way_collision:
  45. - :ref:`bool<class_bool>` **one_way_collision**
  46. +-----------+--------------------------------+
  47. | *Default* | ``false`` |
  48. +-----------+--------------------------------+
  49. | *Setter* | set_one_way_collision(value) |
  50. +-----------+--------------------------------+
  51. | *Getter* | is_one_way_collision_enabled() |
  52. +-----------+--------------------------------+
  53. Sets whether this collision shape should only detect collision on one side (top or bottom).
  54. \ **Note:** This property has no effect if this ``CollisionShape2D`` is a child of an :ref:`Area2D<class_Area2D>` node.
  55. ----
  56. .. _class_CollisionShape2D_property_one_way_collision_margin:
  57. - :ref:`float<class_float>` **one_way_collision_margin**
  58. +-----------+-------------------------------------+
  59. | *Default* | ``1.0`` |
  60. +-----------+-------------------------------------+
  61. | *Setter* | set_one_way_collision_margin(value) |
  62. +-----------+-------------------------------------+
  63. | *Getter* | get_one_way_collision_margin() |
  64. +-----------+-------------------------------------+
  65. 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.
  66. ----
  67. .. _class_CollisionShape2D_property_shape:
  68. - :ref:`Shape2D<class_Shape2D>` **shape**
  69. +----------+------------------+
  70. | *Setter* | set_shape(value) |
  71. +----------+------------------+
  72. | *Getter* | get_shape() |
  73. +----------+------------------+
  74. The actual shape owned by this collision shape.
  75. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  76. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  77. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  78. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  79. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  80. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`