mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2026-01-05 14:10:19 +03:00
254 lines
13 KiB
ReStructuredText
254 lines
13 KiB
ReStructuredText
:github_url: hide
|
||
|
||
.. DO NOT EDIT THIS FILE!!!
|
||
.. Generated automatically from Godot engine sources.
|
||
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
|
||
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/SkeletonModification2DTwoBoneIK.xml.
|
||
|
||
.. _class_SkeletonModification2DTwoBoneIK:
|
||
|
||
SkeletonModification2DTwoBoneIK
|
||
===============================
|
||
|
||
**实验性:** This class may be changed or removed in future versions.
|
||
|
||
**继承:** :ref:`SkeletonModification2D<class_SkeletonModification2D>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
||
|
||
这种修改器会让两个骨骼按照余弦定理进行旋转,最终抵达目标。
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
描述
|
||
----
|
||
|
||
这种 :ref:`SkeletonModification2D<class_SkeletonModification2D>` 所使用的算法一般称之为 TwoBoneIK。这种算法的原理是利用余弦定理和骨骼的长度来推算骨骼当前的旋转量和构成三角形所需的旋转量,三角形由第一根骨骼、第二根骨骼以及目标构成。因为这种算法的原理是构成三角形,所以仅能对两根骨骼进行操作。
|
||
|
||
TwoBoneIK 适用于手臂、腿部,其实任何能够用两根骨头弯向某个目标来代表的关节均能使用。求解器比 :ref:`SkeletonModification2DFABRIK<class_SkeletonModification2DFABRIK>` 更轻量,但也能得到类似的比较自然的结果。
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
属性
|
||
----
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+---------------------------------+--------------------------------------------------------------------------------------------------------+------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`flip_bend_direction<class_SkeletonModification2DTwoBoneIK_property_flip_bend_direction>` | ``false`` |
|
||
+---------------------------------+--------------------------------------------------------------------------------------------------------+------------------+
|
||
| :ref:`float<class_float>` | :ref:`target_maximum_distance<class_SkeletonModification2DTwoBoneIK_property_target_maximum_distance>` | ``0.0`` |
|
||
+---------------------------------+--------------------------------------------------------------------------------------------------------+------------------+
|
||
| :ref:`float<class_float>` | :ref:`target_minimum_distance<class_SkeletonModification2DTwoBoneIK_property_target_minimum_distance>` | ``0.0`` |
|
||
+---------------------------------+--------------------------------------------------------------------------------------------------------+------------------+
|
||
| :ref:`NodePath<class_NodePath>` | :ref:`target_nodepath<class_SkeletonModification2DTwoBoneIK_property_target_nodepath>` | ``NodePath("")`` |
|
||
+---------------------------------+--------------------------------------------------------------------------------------------------------+------------------+
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
方法
|
||
----
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`NodePath<class_NodePath>` | :ref:`get_joint_one_bone2d_node<class_SkeletonModification2DTwoBoneIK_method_get_joint_one_bone2d_node>`\ (\ ) |const| |
|
||
+---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`get_joint_one_bone_idx<class_SkeletonModification2DTwoBoneIK_method_get_joint_one_bone_idx>`\ (\ ) |const| |
|
||
+---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`NodePath<class_NodePath>` | :ref:`get_joint_two_bone2d_node<class_SkeletonModification2DTwoBoneIK_method_get_joint_two_bone2d_node>`\ (\ ) |const| |
|
||
+---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`get_joint_two_bone_idx<class_SkeletonModification2DTwoBoneIK_method_get_joint_two_bone_idx>`\ (\ ) |const| |
|
||
+---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`set_joint_one_bone2d_node<class_SkeletonModification2DTwoBoneIK_method_set_joint_one_bone2d_node>`\ (\ bone2d_node\: :ref:`NodePath<class_NodePath>`\ ) |
|
||
+---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`set_joint_one_bone_idx<class_SkeletonModification2DTwoBoneIK_method_set_joint_one_bone_idx>`\ (\ bone_idx\: :ref:`int<class_int>`\ ) |
|
||
+---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`set_joint_two_bone2d_node<class_SkeletonModification2DTwoBoneIK_method_set_joint_two_bone2d_node>`\ (\ bone2d_node\: :ref:`NodePath<class_NodePath>`\ ) |
|
||
+---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`set_joint_two_bone_idx<class_SkeletonModification2DTwoBoneIK_method_set_joint_two_bone_idx>`\ (\ bone_idx\: :ref:`int<class_int>`\ ) |
|
||
+---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
属性说明
|
||
--------
|
||
|
||
.. _class_SkeletonModification2DTwoBoneIK_property_flip_bend_direction:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **flip_bend_direction** = ``false`` :ref:`🔗<class_SkeletonModification2DTwoBoneIK_property_flip_bend_direction>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_flip_bend_direction**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **get_flip_bend_direction**\ (\ )
|
||
|
||
如果为 ``true``\ ,则该修改中的骨骼在收缩时将向外弯曲,而不是向内弯曲。如果为 ``false``\ ,则骨骼在收缩时会向内弯曲。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_SkeletonModification2DTwoBoneIK_property_target_maximum_distance:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **target_maximum_distance** = ``0.0`` :ref:`🔗<class_SkeletonModification2DTwoBoneIK_property_target_maximum_distance>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_target_maximum_distance**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_target_maximum_distance**\ (\ )
|
||
|
||
该目标可以到达的最大距离。如果目标比这个距离更远,则该修改将如同它就在这个最大距离处一样求解。当设置为 ``0`` 时,则该修改将不受距离限制地求解。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_SkeletonModification2DTwoBoneIK_property_target_minimum_distance:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **target_minimum_distance** = ``0.0`` :ref:`🔗<class_SkeletonModification2DTwoBoneIK_property_target_minimum_distance>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_target_minimum_distance**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_target_minimum_distance**\ (\ )
|
||
|
||
该目标可以到达的最小距离。如果目标比这个距离更近,则该修改将如同它就在这个最小距离处一样求解。当设置为 ``0`` 时,则该修改将不受距离限制地求解。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_SkeletonModification2DTwoBoneIK_property_target_nodepath:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`NodePath<class_NodePath>` **target_nodepath** = ``NodePath("")`` :ref:`🔗<class_SkeletonModification2DTwoBoneIK_property_target_nodepath>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_target_node**\ (\ value\: :ref:`NodePath<class_NodePath>`\ )
|
||
- :ref:`NodePath<class_NodePath>` **get_target_node**\ (\ )
|
||
|
||
作为 TwoBoneIK 修改目标的节点的 NodePath。该节点是弯曲 :ref:`Bone2D<class_Bone2D>` 节点时该修改将使用的节点。
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
方法说明
|
||
--------
|
||
|
||
.. _class_SkeletonModification2DTwoBoneIK_method_get_joint_one_bone2d_node:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`NodePath<class_NodePath>` **get_joint_one_bone2d_node**\ (\ ) |const| :ref:`🔗<class_SkeletonModification2DTwoBoneIK_method_get_joint_one_bone2d_node>`
|
||
|
||
返回 TwoBoneIK 修改器中作为第一个骨骼的 :ref:`Bone2D<class_Bone2D>` 节点。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_SkeletonModification2DTwoBoneIK_method_get_joint_one_bone_idx:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`int<class_int>` **get_joint_one_bone_idx**\ (\ ) |const| :ref:`🔗<class_SkeletonModification2DTwoBoneIK_method_get_joint_one_bone_idx>`
|
||
|
||
返回 TwoBoneIK 修改器中作为第一个骨骼的 :ref:`Bone2D<class_Bone2D>` 节点的索引。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_SkeletonModification2DTwoBoneIK_method_get_joint_two_bone2d_node:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`NodePath<class_NodePath>` **get_joint_two_bone2d_node**\ (\ ) |const| :ref:`🔗<class_SkeletonModification2DTwoBoneIK_method_get_joint_two_bone2d_node>`
|
||
|
||
返回 TwoBoneIK 修改器中作为第二个骨骼的 :ref:`Bone2D<class_Bone2D>` 节点。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_SkeletonModification2DTwoBoneIK_method_get_joint_two_bone_idx:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`int<class_int>` **get_joint_two_bone_idx**\ (\ ) |const| :ref:`🔗<class_SkeletonModification2DTwoBoneIK_method_get_joint_two_bone_idx>`
|
||
|
||
返回 TwoBoneIK 修改器中作为第二个骨骼的 :ref:`Bone2D<class_Bone2D>` 节点的索引。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_SkeletonModification2DTwoBoneIK_method_set_joint_one_bone2d_node:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **set_joint_one_bone2d_node**\ (\ bone2d_node\: :ref:`NodePath<class_NodePath>`\ ) :ref:`🔗<class_SkeletonModification2DTwoBoneIK_method_set_joint_one_bone2d_node>`
|
||
|
||
设置 TwoBoneIK 修改器中作为第一个骨骼的 :ref:`Bone2D<class_Bone2D>` 节点。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_SkeletonModification2DTwoBoneIK_method_set_joint_one_bone_idx:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **set_joint_one_bone_idx**\ (\ bone_idx\: :ref:`int<class_int>`\ ) :ref:`🔗<class_SkeletonModification2DTwoBoneIK_method_set_joint_one_bone_idx>`
|
||
|
||
设置 TwoBoneIK 修改器中作为第一个骨骼的 :ref:`Bone2D<class_Bone2D>` 节点的索引。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_SkeletonModification2DTwoBoneIK_method_set_joint_two_bone2d_node:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **set_joint_two_bone2d_node**\ (\ bone2d_node\: :ref:`NodePath<class_NodePath>`\ ) :ref:`🔗<class_SkeletonModification2DTwoBoneIK_method_set_joint_two_bone2d_node>`
|
||
|
||
设置 TwoBoneIK 修改器中作为第二个骨骼的 :ref:`Bone2D<class_Bone2D>` 节点。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_SkeletonModification2DTwoBoneIK_method_set_joint_two_bone_idx:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **set_joint_two_bone_idx**\ (\ bone_idx\: :ref:`int<class_int>`\ ) :ref:`🔗<class_SkeletonModification2DTwoBoneIK_method_set_joint_two_bone_idx>`
|
||
|
||
设置 TwoBoneIK 修改器中作为第二个骨骼的 :ref:`Bone2D<class_Bone2D>` 节点的索引。
|
||
|
||
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
|
||
.. |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 (无返回值。)`
|