PhysicsBody2D.xml 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="PhysicsBody2D" inherits="CollisionObject2D" category="Core" version="3.1">
  3. <brief_description>
  4. Base class for all objects affected by physics in 2D space.
  5. </brief_description>
  6. <description>
  7. PhysicsBody2D is an abstract base class for implementing a physics body. All *Body2D types inherit from it.
  8. </description>
  9. <tutorials>
  10. <link>https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html</link>
  11. </tutorials>
  12. <demos>
  13. </demos>
  14. <methods>
  15. <method name="add_collision_exception_with">
  16. <return type="void">
  17. </return>
  18. <argument index="0" name="body" type="Node">
  19. </argument>
  20. <description>
  21. Adds a body to the list of bodies that this body can't collide with.
  22. </description>
  23. </method>
  24. <method name="get_collision_exceptions">
  25. <return type="Array">
  26. </return>
  27. <description>
  28. Returns an array of nodes that were added as collision exceptions for this body.
  29. </description>
  30. </method>
  31. <method name="get_collision_layer_bit" qualifiers="const">
  32. <return type="bool">
  33. </return>
  34. <argument index="0" name="bit" type="int">
  35. </argument>
  36. <description>
  37. Returns an individual bit on the collision mask.
  38. </description>
  39. </method>
  40. <method name="get_collision_mask_bit" qualifiers="const">
  41. <return type="bool">
  42. </return>
  43. <argument index="0" name="bit" type="int">
  44. </argument>
  45. <description>
  46. Returns an individual bit on the collision mask.
  47. </description>
  48. </method>
  49. <method name="remove_collision_exception_with">
  50. <return type="void">
  51. </return>
  52. <argument index="0" name="body" type="Node">
  53. </argument>
  54. <description>
  55. Removes a body from the list of bodies that this body can't collide with.
  56. </description>
  57. </method>
  58. <method name="set_collision_layer_bit">
  59. <return type="void">
  60. </return>
  61. <argument index="0" name="bit" type="int">
  62. </argument>
  63. <argument index="1" name="value" type="bool">
  64. </argument>
  65. <description>
  66. Sets individual bits on the layer mask. Use this if you only need to change one layer's value.
  67. </description>
  68. </method>
  69. <method name="set_collision_mask_bit">
  70. <return type="void">
  71. </return>
  72. <argument index="0" name="bit" type="int">
  73. </argument>
  74. <argument index="1" name="value" type="bool">
  75. </argument>
  76. <description>
  77. Sets individual bits on the collision mask. Use this if you only need to change one layer's value.
  78. </description>
  79. </method>
  80. </methods>
  81. <members>
  82. <member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer">
  83. The physics layers this area is in.
  84. Collidable objects can exist in any of 32 different layers. These layers work like a tagging system, and are not visual. A collidable can use these layers to select with which objects it can collide, using the collision_mask property.
  85. A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A.
  86. </member>
  87. <member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask">
  88. The physics layers this area scans for collisions.
  89. </member>
  90. <member name="layers" type="int" setter="_set_layers" getter="_get_layers">
  91. Both [member collision_layer] and [member collision_mask]. Returns [member collision_layer] when accessed. Updates [member collision_layer] and [member collision_mask] when modified.
  92. </member>
  93. </members>
  94. <constants>
  95. </constants>
  96. </class>