123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- :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
- ===============================
- **Experimental:** This class may be changed or removed in future versions.
- **Inherits:** :ref:`SkeletonModification2D<class_SkeletonModification2D>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
- A modification that rotates two bones using the law of cosines to reach the target.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- This :ref:`SkeletonModification2D<class_SkeletonModification2D>` uses an algorithm typically called TwoBoneIK. This algorithm works by leveraging the law of cosines and the lengths of the bones to figure out what rotation the bones currently have, and what rotation they need to make a complete triangle, where the first bone, the second bone, and the target form the three vertices of the triangle. Because the algorithm works by making a triangle, it can only operate on two bones.
- TwoBoneIK is great for arms, legs, and really any joints that can be represented by just two bones that bend to reach a target. This solver is more lightweight than :ref:`SkeletonModification2DFABRIK<class_SkeletonModification2DFABRIK>`, but gives similar, natural looking results.
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. 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
- Methods
- -------
- .. 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
- Property Descriptions
- ---------------------
- .. _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**\ (\ )
- If ``true``, the bones in the modification will bend outward as opposed to inwards when contracting. If ``false``, the bones will bend inwards when contracting.
- .. 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**\ (\ )
- The maximum distance the target can be at. If the target is farther than this distance, the modification will solve as if it's at this maximum distance. When set to ``0``, the modification will solve without distance constraints.
- .. 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**\ (\ )
- The minimum distance the target can be at. If the target is closer than this distance, the modification will solve as if it's at this minimum distance. When set to ``0``, the modification will solve without distance constraints.
- .. 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**\ (\ )
- The NodePath to the node that is the target for the TwoBoneIK modification. This node is what the modification will use when bending the :ref:`Bone2D<class_Bone2D>` nodes.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _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>`
- Returns the :ref:`Bone2D<class_Bone2D>` node that is being used as the first bone in the TwoBoneIK modification.
- .. 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>`
- Returns the index of the :ref:`Bone2D<class_Bone2D>` node that is being used as the first bone in the TwoBoneIK modification.
- .. 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>`
- Returns the :ref:`Bone2D<class_Bone2D>` node that is being used as the second bone in the TwoBoneIK modification.
- .. 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>`
- Returns the index of the :ref:`Bone2D<class_Bone2D>` node that is being used as the second bone in the TwoBoneIK modification.
- .. 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>`
- Sets the :ref:`Bone2D<class_Bone2D>` node that is being used as the first bone in the TwoBoneIK modification.
- .. 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>`
- Sets the index of the :ref:`Bone2D<class_Bone2D>` node that is being used as the first bone in the TwoBoneIK modification.
- .. 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>`
- Sets the :ref:`Bone2D<class_Bone2D>` node that is being used as the second bone in the TwoBoneIK modification.
- .. 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>`
- Sets the index of the :ref:`Bone2D<class_Bone2D>` node that is being used as the second bone in the TwoBoneIK modification.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
- .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
- .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
- .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
- .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
- .. |void| replace:: :abbr:`void (No return value.)`
|