class_physicsbody.rst 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the PhysicsBody.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_PhysicsBody:
  5. PhysicsBody
  6. ===========
  7. **Inherits:** :ref:`CollisionObject<class_CollisionObject>` **<** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  8. **Inherited By:** :ref:`KinematicBody<class_KinematicBody>`, :ref:`PhysicalBone<class_PhysicalBone>`, :ref:`RigidBody<class_RigidBody>`, :ref:`StaticBody<class_StaticBody>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Base class for all objects affected by physics in 3D space.
  13. Properties
  14. ----------
  15. +-----------------------+--------------------------------------------------------------------+
  16. | :ref:`int<class_int>` | :ref:`collision_layer<class_PhysicsBody_property_collision_layer>` |
  17. +-----------------------+--------------------------------------------------------------------+
  18. | :ref:`int<class_int>` | :ref:`collision_mask<class_PhysicsBody_property_collision_mask>` |
  19. +-----------------------+--------------------------------------------------------------------+
  20. Methods
  21. -------
  22. +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`add_collision_exception_with<class_PhysicsBody_method_add_collision_exception_with>` **(** :ref:`Node<class_Node>` body **)** |
  24. +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`Array<class_Array>` | :ref:`get_collision_exceptions<class_PhysicsBody_method_get_collision_exceptions>` **(** **)** |
  26. +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`bool<class_bool>` | :ref:`get_collision_layer_bit<class_PhysicsBody_method_get_collision_layer_bit>` **(** :ref:`int<class_int>` bit **)** const |
  28. +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`bool<class_bool>` | :ref:`get_collision_mask_bit<class_PhysicsBody_method_get_collision_mask_bit>` **(** :ref:`int<class_int>` bit **)** const |
  30. +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`remove_collision_exception_with<class_PhysicsBody_method_remove_collision_exception_with>` **(** :ref:`Node<class_Node>` body **)** |
  32. +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`set_collision_layer_bit<class_PhysicsBody_method_set_collision_layer_bit>` **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)** |
  34. +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`set_collision_mask_bit<class_PhysicsBody_method_set_collision_mask_bit>` **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)** |
  36. +---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. Description
  38. -----------
  39. PhysicsBody is an abstract base class for implementing a physics body. All \*Body types inherit from it.
  40. Tutorials
  41. ---------
  42. - :doc:`../tutorials/physics/physics_introduction`
  43. Property Descriptions
  44. ---------------------
  45. .. _class_PhysicsBody_property_collision_layer:
  46. - :ref:`int<class_int>` **collision_layer**
  47. +----------+----------------------------+
  48. | *Setter* | set_collision_layer(value) |
  49. +----------+----------------------------+
  50. | *Getter* | get_collision_layer() |
  51. +----------+----------------------------+
  52. The physics layers this area is in.
  53. 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.
  54. 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.
  55. .. _class_PhysicsBody_property_collision_mask:
  56. - :ref:`int<class_int>` **collision_mask**
  57. +----------+---------------------------+
  58. | *Setter* | set_collision_mask(value) |
  59. +----------+---------------------------+
  60. | *Getter* | get_collision_mask() |
  61. +----------+---------------------------+
  62. The physics layers this area scans for collisions.
  63. Method Descriptions
  64. -------------------
  65. .. _class_PhysicsBody_method_add_collision_exception_with:
  66. - void **add_collision_exception_with** **(** :ref:`Node<class_Node>` body **)**
  67. Adds a body to the list of bodies that this body can't collide with.
  68. .. _class_PhysicsBody_method_get_collision_exceptions:
  69. - :ref:`Array<class_Array>` **get_collision_exceptions** **(** **)**
  70. Returns an array of nodes that were added as collision exceptions for this body.
  71. .. _class_PhysicsBody_method_get_collision_layer_bit:
  72. - :ref:`bool<class_bool>` **get_collision_layer_bit** **(** :ref:`int<class_int>` bit **)** const
  73. Returns an individual bit on the collision mask.
  74. .. _class_PhysicsBody_method_get_collision_mask_bit:
  75. - :ref:`bool<class_bool>` **get_collision_mask_bit** **(** :ref:`int<class_int>` bit **)** const
  76. Returns an individual bit on the collision mask.
  77. .. _class_PhysicsBody_method_remove_collision_exception_with:
  78. - void **remove_collision_exception_with** **(** :ref:`Node<class_Node>` body **)**
  79. Removes a body from the list of bodies that this body can't collide with.
  80. .. _class_PhysicsBody_method_set_collision_layer_bit:
  81. - void **set_collision_layer_bit** **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)**
  82. Sets individual bits on the layer mask. Use this if you only need to change one layer's value.
  83. .. _class_PhysicsBody_method_set_collision_mask_bit:
  84. - void **set_collision_mask_bit** **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)**
  85. Sets individual bits on the collision mask. Use this if you only need to change one layer's value.