mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
classref: Sync with current master branch (f87858a8f)
This commit is contained in:
@@ -14,6 +14,8 @@ PhysicalBone2D
|
||||
|
||||
A 2D node that can be used for physically aware bones in 2D.
|
||||
|
||||
.. rst-class:: classref-introduction-group
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
@@ -23,127 +25,158 @@ The ``PhysicalBone2D`` node is a :ref:`RigidBody2D<class_RigidBody2D>`-based nod
|
||||
|
||||
\ **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 it's been created as a child node.
|
||||
|
||||
.. rst-class:: classref-reftable-group
|
||||
|
||||
Properties
|
||||
----------
|
||||
|
||||
+---------------------------------+-----------------------------------------------------------------------------------------------+------------------+
|
||||
| :ref:`bool<class_bool>` | :ref:`auto_configure_joint<class_PhysicalBone2D_property_auto_configure_joint>` | ``true`` |
|
||||
+---------------------------------+-----------------------------------------------------------------------------------------------+------------------+
|
||||
| :ref:`int<class_int>` | :ref:`bone2d_index<class_PhysicalBone2D_property_bone2d_index>` | ``-1`` |
|
||||
+---------------------------------+-----------------------------------------------------------------------------------------------+------------------+
|
||||
| :ref:`NodePath<class_NodePath>` | :ref:`bone2d_nodepath<class_PhysicalBone2D_property_bone2d_nodepath>` | ``NodePath("")`` |
|
||||
+---------------------------------+-----------------------------------------------------------------------------------------------+------------------+
|
||||
| :ref:`bool<class_bool>` | :ref:`follow_bone_when_simulating<class_PhysicalBone2D_property_follow_bone_when_simulating>` | ``false`` |
|
||||
+---------------------------------+-----------------------------------------------------------------------------------------------+------------------+
|
||||
| :ref:`bool<class_bool>` | :ref:`simulate_physics<class_PhysicalBone2D_property_simulate_physics>` | ``false`` |
|
||||
+---------------------------------+-----------------------------------------------------------------------------------------------+------------------+
|
||||
.. table::
|
||||
:widths: auto
|
||||
|
||||
+---------------------------------+-----------------------------------------------------------------------------------------------+------------------+
|
||||
| :ref:`bool<class_bool>` | :ref:`auto_configure_joint<class_PhysicalBone2D_property_auto_configure_joint>` | ``true`` |
|
||||
+---------------------------------+-----------------------------------------------------------------------------------------------+------------------+
|
||||
| :ref:`int<class_int>` | :ref:`bone2d_index<class_PhysicalBone2D_property_bone2d_index>` | ``-1`` |
|
||||
+---------------------------------+-----------------------------------------------------------------------------------------------+------------------+
|
||||
| :ref:`NodePath<class_NodePath>` | :ref:`bone2d_nodepath<class_PhysicalBone2D_property_bone2d_nodepath>` | ``NodePath("")`` |
|
||||
+---------------------------------+-----------------------------------------------------------------------------------------------+------------------+
|
||||
| :ref:`bool<class_bool>` | :ref:`follow_bone_when_simulating<class_PhysicalBone2D_property_follow_bone_when_simulating>` | ``false`` |
|
||||
+---------------------------------+-----------------------------------------------------------------------------------------------+------------------+
|
||||
| :ref:`bool<class_bool>` | :ref:`simulate_physics<class_PhysicalBone2D_property_simulate_physics>` | ``false`` |
|
||||
+---------------------------------+-----------------------------------------------------------------------------------------------+------------------+
|
||||
|
||||
.. rst-class:: classref-reftable-group
|
||||
|
||||
Methods
|
||||
-------
|
||||
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Joint2D<class_Joint2D>` | :ref:`get_joint<class_PhysicalBone2D_method_get_joint>` **(** **)** |const| |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------+
|
||||
| :ref:`bool<class_bool>` | :ref:`is_simulating_physics<class_PhysicalBone2D_method_is_simulating_physics>` **(** **)** |const| |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------+
|
||||
.. table::
|
||||
:widths: auto
|
||||
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Joint2D<class_Joint2D>` | :ref:`get_joint<class_PhysicalBone2D_method_get_joint>` **(** **)** |const| |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------+
|
||||
| :ref:`bool<class_bool>` | :ref:`is_simulating_physics<class_PhysicalBone2D_method_is_simulating_physics>` **(** **)** |const| |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------+
|
||||
|
||||
.. rst-class:: classref-section-separator
|
||||
|
||||
----
|
||||
|
||||
.. rst-class:: classref-descriptions-group
|
||||
|
||||
Property Descriptions
|
||||
---------------------
|
||||
|
||||
.. _class_PhysicalBone2D_property_auto_configure_joint:
|
||||
|
||||
- :ref:`bool<class_bool>` **auto_configure_joint**
|
||||
.. rst-class:: classref-property
|
||||
|
||||
+-----------+---------------------------------+
|
||||
| *Default* | ``true`` |
|
||||
+-----------+---------------------------------+
|
||||
| *Setter* | set_auto_configure_joint(value) |
|
||||
+-----------+---------------------------------+
|
||||
| *Getter* | get_auto_configure_joint() |
|
||||
+-----------+---------------------------------+
|
||||
:ref:`bool<class_bool>` **auto_configure_joint** = ``true``
|
||||
|
||||
.. rst-class:: classref-property-setget
|
||||
|
||||
- void **set_auto_configure_joint** **(** :ref:`bool<class_bool>` value **)**
|
||||
- :ref:`bool<class_bool>` **get_auto_configure_joint** **(** **)**
|
||||
|
||||
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>`.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_PhysicalBone2D_property_bone2d_index:
|
||||
|
||||
- :ref:`int<class_int>` **bone2d_index**
|
||||
.. rst-class:: classref-property
|
||||
|
||||
+-----------+-------------------------+
|
||||
| *Default* | ``-1`` |
|
||||
+-----------+-------------------------+
|
||||
| *Setter* | set_bone2d_index(value) |
|
||||
+-----------+-------------------------+
|
||||
| *Getter* | get_bone2d_index() |
|
||||
+-----------+-------------------------+
|
||||
:ref:`int<class_int>` **bone2d_index** = ``-1``
|
||||
|
||||
.. rst-class:: classref-property-setget
|
||||
|
||||
- void **set_bone2d_index** **(** :ref:`int<class_int>` value **)**
|
||||
- :ref:`int<class_int>` **get_bone2d_index** **(** **)**
|
||||
|
||||
The index of the :ref:`Bone2D<class_Bone2D>` node that this ``PhysicalBone2D`` node is supposed to be simulating.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_PhysicalBone2D_property_bone2d_nodepath:
|
||||
|
||||
- :ref:`NodePath<class_NodePath>` **bone2d_nodepath**
|
||||
.. rst-class:: classref-property
|
||||
|
||||
+-----------+----------------------------+
|
||||
| *Default* | ``NodePath("")`` |
|
||||
+-----------+----------------------------+
|
||||
| *Setter* | set_bone2d_nodepath(value) |
|
||||
+-----------+----------------------------+
|
||||
| *Getter* | get_bone2d_nodepath() |
|
||||
+-----------+----------------------------+
|
||||
:ref:`NodePath<class_NodePath>` **bone2d_nodepath** = ``NodePath("")``
|
||||
|
||||
.. rst-class:: classref-property-setget
|
||||
|
||||
- void **set_bone2d_nodepath** **(** :ref:`NodePath<class_NodePath>` value **)**
|
||||
- :ref:`NodePath<class_NodePath>` **get_bone2d_nodepath** **(** **)**
|
||||
|
||||
The :ref:`NodePath<class_NodePath>` to the :ref:`Bone2D<class_Bone2D>` node that this ``PhysicalBone2D`` node is supposed to be simulating.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_PhysicalBone2D_property_follow_bone_when_simulating:
|
||||
|
||||
- :ref:`bool<class_bool>` **follow_bone_when_simulating**
|
||||
.. rst-class:: classref-property
|
||||
|
||||
+-----------+----------------------------------------+
|
||||
| *Default* | ``false`` |
|
||||
+-----------+----------------------------------------+
|
||||
| *Setter* | set_follow_bone_when_simulating(value) |
|
||||
+-----------+----------------------------------------+
|
||||
| *Getter* | get_follow_bone_when_simulating() |
|
||||
+-----------+----------------------------------------+
|
||||
:ref:`bool<class_bool>` **follow_bone_when_simulating** = ``false``
|
||||
|
||||
.. rst-class:: classref-property-setget
|
||||
|
||||
- void **set_follow_bone_when_simulating** **(** :ref:`bool<class_bool>` value **)**
|
||||
- :ref:`bool<class_bool>` **get_follow_bone_when_simulating** **(** **)**
|
||||
|
||||
If ``true``, the ``PhysicalBone2D`` will keep the transform of the bone it is bound to when simulating physics.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_PhysicalBone2D_property_simulate_physics:
|
||||
|
||||
- :ref:`bool<class_bool>` **simulate_physics**
|
||||
.. rst-class:: classref-property
|
||||
|
||||
+-----------+-----------------------------+
|
||||
| *Default* | ``false`` |
|
||||
+-----------+-----------------------------+
|
||||
| *Setter* | set_simulate_physics(value) |
|
||||
+-----------+-----------------------------+
|
||||
| *Getter* | get_simulate_physics() |
|
||||
+-----------+-----------------------------+
|
||||
:ref:`bool<class_bool>` **simulate_physics** = ``false``
|
||||
|
||||
.. rst-class:: classref-property-setget
|
||||
|
||||
- void **set_simulate_physics** **(** :ref:`bool<class_bool>` value **)**
|
||||
- :ref:`bool<class_bool>` **get_simulate_physics** **(** **)**
|
||||
|
||||
If ``true``, the ``PhysicalBone2D`` will start simulating using physics. If ``false``, the ``PhysicalBone2D`` will follow the transform of the :ref:`Bone2D<class_Bone2D>` node.
|
||||
|
||||
\ **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.
|
||||
|
||||
.. rst-class:: classref-section-separator
|
||||
|
||||
----
|
||||
|
||||
.. rst-class:: classref-descriptions-group
|
||||
|
||||
Method Descriptions
|
||||
-------------------
|
||||
|
||||
.. _class_PhysicalBone2D_method_get_joint:
|
||||
|
||||
- :ref:`Joint2D<class_Joint2D>` **get_joint** **(** **)** |const|
|
||||
.. rst-class:: classref-method
|
||||
|
||||
:ref:`Joint2D<class_Joint2D>` **get_joint** **(** **)** |const|
|
||||
|
||||
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.
|
||||
|
||||
.. rst-class:: classref-item-separator
|
||||
|
||||
----
|
||||
|
||||
.. _class_PhysicalBone2D_method_is_simulating_physics:
|
||||
|
||||
- :ref:`bool<class_bool>` **is_simulating_physics** **(** **)** |const|
|
||||
.. rst-class:: classref-method
|
||||
|
||||
:ref:`bool<class_bool>` **is_simulating_physics** **(** **)** |const|
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user