class_physicsbody2d.rst 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/PhysicsBody2D.xml.
  6. .. _class_PhysicsBody2D:
  7. PhysicsBody2D
  8. =============
  9. **Inherits:** :ref:`CollisionObject2D<class_CollisionObject2D>` **<** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`KinematicBody2D<class_KinematicBody2D>`, :ref:`RigidBody2D<class_RigidBody2D>`, :ref:`StaticBody2D<class_StaticBody2D>`
  11. Base class for all objects affected by physics in 2D space.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. PhysicsBody2D is an abstract base class for implementing a physics body. All \*Body2D types inherit from it.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - :doc:`../tutorials/physics/physics_introduction`
  20. .. rst-class:: classref-reftable-group
  21. Properties
  22. ----------
  23. .. table::
  24. :widths: auto
  25. +-------------------------+----------------------------------------------------+-------------------------------------------------------------------------------------------------+
  26. | :ref:`bool<class_bool>` | input_pickable | ``false`` (overrides :ref:`CollisionObject2D<class_CollisionObject2D_property_input_pickable>`) |
  27. +-------------------------+----------------------------------------------------+-------------------------------------------------------------------------------------------------+
  28. | :ref:`int<class_int>` | :ref:`layers<class_PhysicsBody2D_property_layers>` | |
  29. +-------------------------+----------------------------------------------------+-------------------------------------------------------------------------------------------------+
  30. .. rst-class:: classref-reftable-group
  31. Methods
  32. -------
  33. .. table::
  34. :widths: auto
  35. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  36. | void | :ref:`add_collision_exception_with<class_PhysicsBody2D_method_add_collision_exception_with>` **(** :ref:`Node<class_Node>` body **)** |
  37. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`Array<class_Array>` | :ref:`get_collision_exceptions<class_PhysicsBody2D_method_get_collision_exceptions>` **(** **)** |
  39. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`remove_collision_exception_with<class_PhysicsBody2D_method_remove_collision_exception_with>` **(** :ref:`Node<class_Node>` body **)** |
  41. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  42. .. rst-class:: classref-section-separator
  43. ----
  44. .. rst-class:: classref-descriptions-group
  45. Property Descriptions
  46. ---------------------
  47. .. _class_PhysicsBody2D_property_layers:
  48. .. rst-class:: classref-property
  49. :ref:`int<class_int>` **layers**
  50. Both collision_layer and collision_mask. Returns collision_layer when accessed. Updates collision_layer and collision_mask when modified.
  51. .. rst-class:: classref-section-separator
  52. ----
  53. .. rst-class:: classref-descriptions-group
  54. Method Descriptions
  55. -------------------
  56. .. _class_PhysicsBody2D_method_add_collision_exception_with:
  57. .. rst-class:: classref-method
  58. void **add_collision_exception_with** **(** :ref:`Node<class_Node>` body **)**
  59. Adds a body to the list of bodies that this body can't collide with.
  60. .. rst-class:: classref-item-separator
  61. ----
  62. .. _class_PhysicsBody2D_method_get_collision_exceptions:
  63. .. rst-class:: classref-method
  64. :ref:`Array<class_Array>` **get_collision_exceptions** **(** **)**
  65. Returns an array of nodes that were added as collision exceptions for this body.
  66. .. rst-class:: classref-item-separator
  67. ----
  68. .. _class_PhysicsBody2D_method_remove_collision_exception_with:
  69. .. rst-class:: classref-method
  70. void **remove_collision_exception_with** **(** :ref:`Node<class_Node>` body **)**
  71. Removes a body from the list of bodies that this body can't collide with.
  72. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  73. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  74. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  75. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`