Files
godot-docs-l10n/classes/zh_Hans/class_joint2d.rst

152 lines
5.9 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

:github_url: hide
.. _class_Joint2D:
Joint2D
=======
**继承:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
**派生:** :ref:`DampedSpringJoint2D<class_DampedSpringJoint2D>`, :ref:`GrooveJoint2D<class_GrooveJoint2D>`, :ref:`PinJoint2D<class_PinJoint2D>`
所有 2D 物理关节的抽象基类。
.. rst-class:: classref-introduction-group
描述
----
2D 物理中所有关节的抽象基类。2D 关节能够将两个物理体(\ :ref:`node_a<class_Joint2D_property_node_a>`:ref:`node_b<class_Joint2D_property_node_b>`\ )绑定在一起并施加约束。
.. rst-class:: classref-reftable-group
属性
----
.. table::
:widths: auto
+---------------------------------+--------------------------------------------------------------------+------------------+
| :ref:`float<class_float>` | :ref:`bias<class_Joint2D_property_bias>` | ``0.0`` |
+---------------------------------+--------------------------------------------------------------------+------------------+
| :ref:`bool<class_bool>` | :ref:`disable_collision<class_Joint2D_property_disable_collision>` | ``true`` |
+---------------------------------+--------------------------------------------------------------------+------------------+
| :ref:`NodePath<class_NodePath>` | :ref:`node_a<class_Joint2D_property_node_a>` | ``NodePath("")`` |
+---------------------------------+--------------------------------------------------------------------+------------------+
| :ref:`NodePath<class_NodePath>` | :ref:`node_b<class_Joint2D_property_node_b>` | ``NodePath("")`` |
+---------------------------------+--------------------------------------------------------------------+------------------+
.. rst-class:: classref-reftable-group
方法
----
.. table::
:widths: auto
+-----------------------+------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`get_rid<class_Joint2D_method_get_rid>`\ (\ ) |const| |
+-----------------------+------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
属性说明
--------
.. _class_Joint2D_property_bias:
.. rst-class:: classref-property
:ref:`float<class_float>` **bias** = ``0.0`` :ref:`🔗<class_Joint2D_property_bias>`
.. rst-class:: classref-property-setget
- |void| **set_bias**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_bias**\ (\ )
:ref:`node_a<class_Joint2D_property_node_a>`:ref:`node_b<class_Joint2D_property_node_b>` 向不同方向移动时,\ :ref:`bias<class_Joint2D_property_bias>` 控制关节将它们拉回到原始位置的速度。\ :ref:`bias<class_Joint2D_property_bias>` 越低,两个实体对该关节的拉力就越大。
当被设置为 ``0`` 时,使用来自 :ref:`ProjectSettings.physics/2d/solver/default_constraint_bias<class_ProjectSettings_property_physics/2d/solver/default_constraint_bias>` 的默认值。
.. rst-class:: classref-item-separator
----
.. _class_Joint2D_property_disable_collision:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **disable_collision** = ``true`` :ref:`🔗<class_Joint2D_property_disable_collision>`
.. rst-class:: classref-property-setget
- |void| **set_exclude_nodes_from_collision**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_exclude_nodes_from_collision**\ (\ )
如果为 ``true``\ ,则绑定在一起的两个物体不会相互碰撞。
.. rst-class:: classref-item-separator
----
.. _class_Joint2D_property_node_a:
.. rst-class:: classref-property
:ref:`NodePath<class_NodePath>` **node_a** = ``NodePath("")`` :ref:`🔗<class_Joint2D_property_node_a>`
.. rst-class:: classref-property-setget
- |void| **set_node_a**\ (\ value\: :ref:`NodePath<class_NodePath>`\ )
- :ref:`NodePath<class_NodePath>` **get_node_a**\ (\ )
连接到关节的第一个物体A的路径。该节点必须继承自 :ref:`PhysicsBody2D<class_PhysicsBody2D>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_Joint2D_property_node_b:
.. rst-class:: classref-property
:ref:`NodePath<class_NodePath>` **node_b** = ``NodePath("")`` :ref:`🔗<class_Joint2D_property_node_b>`
.. rst-class:: classref-property-setget
- |void| **set_node_b**\ (\ value\: :ref:`NodePath<class_NodePath>`\ )
- :ref:`NodePath<class_NodePath>` **get_node_b**\ (\ )
连接到关节的第二个物体B的路径。该节点必须继承自 :ref:`PhysicsBody2D<class_PhysicsBody2D>`\ 。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
方法说明
--------
.. _class_Joint2D_method_get_rid:
.. rst-class:: classref-method
:ref:`RID<class_RID>` **get_rid**\ (\ ) |const| :ref:`🔗<class_Joint2D_method_get_rid>`
:ref:`PhysicsServer2D<class_PhysicsServer2D>` 返回关节的内部 :ref:`RID<class_RID>`\ 。
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`
.. |vararg| replace:: :abbr:`vararg (本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。)`
.. |constructor| replace:: :abbr:`constructor (本方法用于构造某个类型。)`
.. |static| replace:: :abbr:`static (调用本方法无需实例,可直接使用类名进行调用。)`
.. |operator| replace:: :abbr:`operator (本方法描述的是使用本类型作为左操作数的有效运算符。)`
.. |bitfield| replace:: :abbr:`BitField (这个值是由下列位标志构成位掩码的整数。)`
.. |void| replace:: :abbr:`void (无返回值。)`