class_physicsbody.rst 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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:`PhysicalBone<class_PhysicalBone>`, :ref:`StaticBody<class_StaticBody>`, :ref:`KinematicBody<class_KinematicBody>`, :ref:`RigidBody<class_RigidBody>`
  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_collision_layer>` |
  17. +-----------------------+-----------------------------------------------------------+
  18. | :ref:`int<class_int>` | :ref:`collision_mask<class_PhysicsBody_collision_mask>` |
  19. +-----------------------+-----------------------------------------------------------+
  20. Methods
  21. -------
  22. +--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`add_collision_exception_with<class_PhysicsBody_add_collision_exception_with>` **(** :ref:`Node<class_Node>` body **)** |
  24. +--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`bool<class_bool>` | :ref:`get_collision_layer_bit<class_PhysicsBody_get_collision_layer_bit>` **(** :ref:`int<class_int>` bit **)** const |
  26. +--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`bool<class_bool>` | :ref:`get_collision_mask_bit<class_PhysicsBody_get_collision_mask_bit>` **(** :ref:`int<class_int>` bit **)** const |
  28. +--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | void | :ref:`remove_collision_exception_with<class_PhysicsBody_remove_collision_exception_with>` **(** :ref:`Node<class_Node>` body **)** |
  30. +--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`set_collision_layer_bit<class_PhysicsBody_set_collision_layer_bit>` **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)** |
  32. +--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`set_collision_mask_bit<class_PhysicsBody_set_collision_mask_bit>` **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)** |
  34. +--------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  35. Description
  36. -----------
  37. PhysicsBody is an abstract base class for implementing a physics body. All \*Body types inherit from it.
  38. Tutorials
  39. ---------
  40. - :doc:`../tutorials/physics/physics_introduction`
  41. Property Descriptions
  42. ---------------------
  43. .. _class_PhysicsBody_collision_layer:
  44. - :ref:`int<class_int>` **collision_layer**
  45. +----------+----------------------------+
  46. | *Setter* | set_collision_layer(value) |
  47. +----------+----------------------------+
  48. | *Getter* | get_collision_layer() |
  49. +----------+----------------------------+
  50. The physics layers this area is in.
  51. 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.
  52. 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.
  53. .. _class_PhysicsBody_collision_mask:
  54. - :ref:`int<class_int>` **collision_mask**
  55. +----------+---------------------------+
  56. | *Setter* | set_collision_mask(value) |
  57. +----------+---------------------------+
  58. | *Getter* | get_collision_mask() |
  59. +----------+---------------------------+
  60. The physics layers this area scans for collisions.
  61. Method Descriptions
  62. -------------------
  63. .. _class_PhysicsBody_add_collision_exception_with:
  64. - void **add_collision_exception_with** **(** :ref:`Node<class_Node>` body **)**
  65. Adds a body to the list of bodies that this body can't collide with.
  66. .. _class_PhysicsBody_get_collision_layer_bit:
  67. - :ref:`bool<class_bool>` **get_collision_layer_bit** **(** :ref:`int<class_int>` bit **)** const
  68. Returns an individual bit on the collision mask.
  69. .. _class_PhysicsBody_get_collision_mask_bit:
  70. - :ref:`bool<class_bool>` **get_collision_mask_bit** **(** :ref:`int<class_int>` bit **)** const
  71. Returns an individual bit on the collision mask.
  72. .. _class_PhysicsBody_remove_collision_exception_with:
  73. - void **remove_collision_exception_with** **(** :ref:`Node<class_Node>` body **)**
  74. Removes a body from the list of bodies that this body can't collide with.
  75. .. _class_PhysicsBody_set_collision_layer_bit:
  76. - void **set_collision_layer_bit** **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)**
  77. Sets individual bits on the layer mask. Use this if you only need to change one layer's value.
  78. .. _class_PhysicsBody_set_collision_mask_bit:
  79. - void **set_collision_mask_bit** **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)**
  80. Sets individual bits on the collision mask. Use this if you only need to change one layer's value.