Files
godot-docs-l10n/classes/zh_Hant/class_physicsmaterial.rst

121 lines
4.9 KiB
ReStructuredText

:github_url: hide
.. _class_PhysicsMaterial:
PhysicsMaterial
===============
**繼承:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
存放與表面的物理相關的屬性,也就是粗糙度和反彈度。
.. rst-class:: classref-introduction-group
說明
----
存放與表面的物理相關的屬性,也就是粗糙度和反彈度。這個類用於將這些屬性套用至物理體。
.. rst-class:: classref-reftable-group
屬性
----
.. table::
:widths: auto
+---------------------------+------------------------------------------------------------+-----------+
| :ref:`bool<class_bool>` | :ref:`absorbent<class_PhysicsMaterial_property_absorbent>` | ``false`` |
+---------------------------+------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`bounce<class_PhysicsMaterial_property_bounce>` | ``0.0`` |
+---------------------------+------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`friction<class_PhysicsMaterial_property_friction>` | ``1.0`` |
+---------------------------+------------------------------------------------------------+-----------+
| :ref:`bool<class_bool>` | :ref:`rough<class_PhysicsMaterial_property_rough>` | ``false`` |
+---------------------------+------------------------------------------------------------+-----------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
屬性說明
--------
.. _class_PhysicsMaterial_property_absorbent:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **absorbent** = ``false`` :ref:`🔗<class_PhysicsMaterial_property_absorbent>`
.. rst-class:: classref-property-setget
- |void| **set_absorbent**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_absorbent**\ (\ )
如果為 ``true``\ ,則從碰撞對象的彈跳性中減去彈性,而不是新增它。
.. rst-class:: classref-item-separator
----
.. _class_PhysicsMaterial_property_bounce:
.. rst-class:: classref-property
:ref:`float<class_float>` **bounce** = ``0.0`` :ref:`🔗<class_PhysicsMaterial_property_bounce>`
.. rst-class:: classref-property-setget
- |void| **set_bounce**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_bounce**\ (\ )
The body's bounciness. Values range from ``0`` (no bounce) to ``1`` (full bounciness).
\ **Note:** Even with :ref:`bounce<class_PhysicsMaterial_property_bounce>` set to ``1.0``, some energy will be lost over time due to linear and angular damping. To have a physics body that preserves all its energy over time, set :ref:`bounce<class_PhysicsMaterial_property_bounce>` to ``1.0``, the body's linear damp mode to **Replace** (if applicable), its linear damp to ``0.0``, its angular damp mode to **Replace** (if applicable), and its angular damp to ``0.0``.
.. rst-class:: classref-item-separator
----
.. _class_PhysicsMaterial_property_friction:
.. rst-class:: classref-property
:ref:`float<class_float>` **friction** = ``1.0`` :ref:`🔗<class_PhysicsMaterial_property_friction>`
.. rst-class:: classref-property-setget
- |void| **set_friction**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_friction**\ (\ )
物體的摩擦。取值範圍從 ``0``\ (無摩擦)到 ``1``\ (最大摩擦)。
.. rst-class:: classref-item-separator
----
.. _class_PhysicsMaterial_property_rough:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **rough** = ``false`` :ref:`🔗<class_PhysicsMaterial_property_rough>`
.. rst-class:: classref-property-setget
- |void| **set_rough**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_rough**\ (\ )
如果為 ``true``\ ,當兩個物體碰撞時,物理引擎將使用標記為“粗糙”的物體的摩擦。如果 ``false``\ ,物理引擎將使用所有碰撞物體的最低摩擦力來代替。如果兩個碰撞的物件都為 ``true``\ ,物理引擎將使用最高的摩擦力。
.. |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 (無回傳值。)`