:github_url: hide .. _class_PinJoint2D: PinJoint2D ========== **繼承:** :ref:`Joint2D` **<** :ref:`Node2D` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` 將兩個 2D 物理體通過單點進行連接的物理關節,能夠讓它們自由旋轉。 .. rst-class:: classref-introduction-group 說明 ---- 將兩個 2D 物理體通過單點進行連接的物理關節,能夠讓它們自由旋轉。例如可以將 :ref:`RigidBody2D` 連接到 :ref:`StaticBody2D` 上,從而建立鐘擺或蹺蹺板。 .. rst-class:: classref-reftable-group 屬性 ---- .. table:: :widths: auto +---------------------------+-------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`angular_limit_enabled` | ``false`` | +---------------------------+-------------------------------------------------------------------------------+-----------+ | :ref:`float` | :ref:`angular_limit_lower` | ``0.0`` | +---------------------------+-------------------------------------------------------------------------------+-----------+ | :ref:`float` | :ref:`angular_limit_upper` | ``0.0`` | +---------------------------+-------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`motor_enabled` | ``false`` | +---------------------------+-------------------------------------------------------------------------------+-----------+ | :ref:`float` | :ref:`motor_target_velocity` | ``0.0`` | +---------------------------+-------------------------------------------------------------------------------+-----------+ | :ref:`float` | :ref:`softness` | ``0.0`` | +---------------------------+-------------------------------------------------------------------------------+-----------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group 屬性說明 -------- .. _class_PinJoint2D_property_angular_limit_enabled: .. rst-class:: classref-property :ref:`bool` **angular_limit_enabled** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_angular_limit_enabled**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_angular_limit_enabled**\ (\ ) If ``true``, the pin maximum and minimum rotation, defined by :ref:`angular_limit_lower` and :ref:`angular_limit_upper` are applied. .. rst-class:: classref-item-separator ---- .. _class_PinJoint2D_property_angular_limit_lower: .. rst-class:: classref-property :ref:`float` **angular_limit_lower** = ``0.0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_angular_limit_lower**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_angular_limit_lower**\ (\ ) 最小的旋轉量。只有在\ :ref:`angular_limit_enabled`\ 為 ``true`` 時才有效。 .. rst-class:: classref-item-separator ---- .. _class_PinJoint2D_property_angular_limit_upper: .. rst-class:: classref-property :ref:`float` **angular_limit_upper** = ``0.0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_angular_limit_upper**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_angular_limit_upper**\ (\ ) 最大的旋轉量。只有在\ :ref:`angular_limit_enabled`\ 為 ``true`` 時才有效。 .. rst-class:: classref-item-separator ---- .. _class_PinJoint2D_property_motor_enabled: .. rst-class:: classref-property :ref:`bool` **motor_enabled** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_motor_enabled**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_motor_enabled**\ (\ ) 啟動後,馬達會使鉸鏈轉動。 .. rst-class:: classref-item-separator ---- .. _class_PinJoint2D_property_motor_target_velocity: .. rst-class:: classref-property :ref:`float` **motor_target_velocity** = ``0.0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_motor_target_velocity**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_motor_target_velocity**\ (\ ) 軸上馬達的目標速度。 .. rst-class:: classref-item-separator ---- .. _class_PinJoint2D_property_softness: .. rst-class:: classref-property :ref:`float` **softness** = ``0.0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_softness**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_softness**\ (\ ) 這個值越高,與被牽制的兩個物體之間的的聯繫就越靈活。 .. |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 (無回傳值。)`