class_physicalbone2d.rst 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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/PhysicalBone2D.xml.
  6. .. _class_PhysicalBone2D:
  7. PhysicalBone2D
  8. ==============
  9. **Inherits:** :ref:`RigidDynamicBody2D<class_RigidDynamicBody2D>` **<** :ref:`PhysicsBody2D<class_PhysicsBody2D>` **<** :ref:`CollisionObject2D<class_CollisionObject2D>` **<** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A 2D node that can be used for physically aware bones in 2D.
  11. Description
  12. -----------
  13. The ``PhysicalBone2D`` node is a :ref:`RigidDynamicBody2D<class_RigidDynamicBody2D>`-based node that can be used to make :ref:`Bone2D<class_Bone2D>` nodes in a :ref:`Skeleton2D<class_Skeleton2D>` react to physics. This node is very similar to the :ref:`PhysicalBone3D<class_PhysicalBone3D>` node, just for 2D instead of 3D.
  14. \ **Note:** To have the Bone2D nodes visually follow the ``PhysicalBone2D`` node, use a :ref:`SkeletonModification2DPhysicalBones<class_SkeletonModification2DPhysicalBones>` modification on the :ref:`Skeleton2D<class_Skeleton2D>` node with the :ref:`Bone2D<class_Bone2D>` nodes.
  15. \ **Note:** The PhysicalBone2D node does not automatically create a :ref:`Joint2D<class_Joint2D>` node to keep ``PhysicalBone2D`` nodes together. You will need to create these manually. For most cases, you want to use a :ref:`PinJoint2D<class_PinJoint2D>` node. The ``PhysicalBone2D`` node can automatically configure the :ref:`Joint2D<class_Joint2D>` node once its been created as a child node.
  16. Properties
  17. ----------
  18. +---------------------------------+-----------------------------------------------------------------------------------------------+------------------+
  19. | :ref:`bool<class_bool>` | :ref:`auto_configure_joint<class_PhysicalBone2D_property_auto_configure_joint>` | ``true`` |
  20. +---------------------------------+-----------------------------------------------------------------------------------------------+------------------+
  21. | :ref:`int<class_int>` | :ref:`bone2d_index<class_PhysicalBone2D_property_bone2d_index>` | ``-1`` |
  22. +---------------------------------+-----------------------------------------------------------------------------------------------+------------------+
  23. | :ref:`NodePath<class_NodePath>` | :ref:`bone2d_nodepath<class_PhysicalBone2D_property_bone2d_nodepath>` | ``NodePath("")`` |
  24. +---------------------------------+-----------------------------------------------------------------------------------------------+------------------+
  25. | :ref:`bool<class_bool>` | :ref:`follow_bone_when_simulating<class_PhysicalBone2D_property_follow_bone_when_simulating>` | ``false`` |
  26. +---------------------------------+-----------------------------------------------------------------------------------------------+------------------+
  27. | :ref:`bool<class_bool>` | :ref:`simulate_physics<class_PhysicalBone2D_property_simulate_physics>` | ``false`` |
  28. +---------------------------------+-----------------------------------------------------------------------------------------------+------------------+
  29. Methods
  30. -------
  31. +-------------------------------+-----------------------------------------------------------------------------------------------------+
  32. | :ref:`Joint2D<class_Joint2D>` | :ref:`get_joint<class_PhysicalBone2D_method_get_joint>` **(** **)** |const| |
  33. +-------------------------------+-----------------------------------------------------------------------------------------------------+
  34. | :ref:`bool<class_bool>` | :ref:`is_simulating_physics<class_PhysicalBone2D_method_is_simulating_physics>` **(** **)** |const| |
  35. +-------------------------------+-----------------------------------------------------------------------------------------------------+
  36. Property Descriptions
  37. ---------------------
  38. .. _class_PhysicalBone2D_property_auto_configure_joint:
  39. - :ref:`bool<class_bool>` **auto_configure_joint**
  40. +-----------+---------------------------------+
  41. | *Default* | ``true`` |
  42. +-----------+---------------------------------+
  43. | *Setter* | set_auto_configure_joint(value) |
  44. +-----------+---------------------------------+
  45. | *Getter* | get_auto_configure_joint() |
  46. +-----------+---------------------------------+
  47. If ``true``, the ``PhysicalBone2D`` node will automatically configure the first :ref:`Joint2D<class_Joint2D>` child node. The automatic configuration is limited to setting up the node properties and positioning the :ref:`Joint2D<class_Joint2D>`.
  48. ----
  49. .. _class_PhysicalBone2D_property_bone2d_index:
  50. - :ref:`int<class_int>` **bone2d_index**
  51. +-----------+-------------------------+
  52. | *Default* | ``-1`` |
  53. +-----------+-------------------------+
  54. | *Setter* | set_bone2d_index(value) |
  55. +-----------+-------------------------+
  56. | *Getter* | get_bone2d_index() |
  57. +-----------+-------------------------+
  58. The index of the :ref:`Bone2D<class_Bone2D>` node that this ``PhysicalBone2D`` node is supposed to be simulating.
  59. ----
  60. .. _class_PhysicalBone2D_property_bone2d_nodepath:
  61. - :ref:`NodePath<class_NodePath>` **bone2d_nodepath**
  62. +-----------+----------------------------+
  63. | *Default* | ``NodePath("")`` |
  64. +-----------+----------------------------+
  65. | *Setter* | set_bone2d_nodepath(value) |
  66. +-----------+----------------------------+
  67. | *Getter* | get_bone2d_nodepath() |
  68. +-----------+----------------------------+
  69. The :ref:`NodePath<class_NodePath>` to the :ref:`Bone2D<class_Bone2D>` node that this ``PhysicalBone2D`` node is supposed to be simulating.
  70. ----
  71. .. _class_PhysicalBone2D_property_follow_bone_when_simulating:
  72. - :ref:`bool<class_bool>` **follow_bone_when_simulating**
  73. +-----------+----------------------------------------+
  74. | *Default* | ``false`` |
  75. +-----------+----------------------------------------+
  76. | *Setter* | set_follow_bone_when_simulating(value) |
  77. +-----------+----------------------------------------+
  78. | *Getter* | get_follow_bone_when_simulating() |
  79. +-----------+----------------------------------------+
  80. If ``true``, the ``PhysicalBone2D`` will keep the transform of the bone it is bound to when simulating physics.
  81. ----
  82. .. _class_PhysicalBone2D_property_simulate_physics:
  83. - :ref:`bool<class_bool>` **simulate_physics**
  84. +-----------+-----------------------------+
  85. | *Default* | ``false`` |
  86. +-----------+-----------------------------+
  87. | *Setter* | set_simulate_physics(value) |
  88. +-----------+-----------------------------+
  89. | *Getter* | get_simulate_physics() |
  90. +-----------+-----------------------------+
  91. If ``true``, the ``PhysicalBone2D`` will start simulating using physics. If ``false``, the ``PhysicalBone2D`` will follow the transform of the :ref:`Bone2D<class_Bone2D>` node.
  92. \ **Note:** To have the Bone2D nodes visually follow the ``PhysicalBone2D`` node, use a :ref:`SkeletonModification2DPhysicalBones<class_SkeletonModification2DPhysicalBones>` modification on the :ref:`Skeleton2D<class_Skeleton2D>` node with the :ref:`Bone2D<class_Bone2D>` nodes.
  93. Method Descriptions
  94. -------------------
  95. .. _class_PhysicalBone2D_method_get_joint:
  96. - :ref:`Joint2D<class_Joint2D>` **get_joint** **(** **)** |const|
  97. Returns the first :ref:`Joint2D<class_Joint2D>` child node, if one exists. This is mainly a helper function to make it easier to get the :ref:`Joint2D<class_Joint2D>` that the ``PhysicalBone2D`` is autoconfiguring.
  98. ----
  99. .. _class_PhysicalBone2D_method_is_simulating_physics:
  100. - :ref:`bool<class_bool>` **is_simulating_physics** **(** **)** |const|
  101. Returns a boolean that indicates whether the ``PhysicalBone2D`` node is running and simulating using the Godot 2D physics engine. When ``true``, the PhysicalBone2D node is using physics.
  102. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  103. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  104. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  105. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  106. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  107. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`