123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322 |
- :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/SkeletonModification2DCCDIK.xml.
- .. _class_SkeletonModification2DCCDIK:
- SkeletonModification2DCCDIK
- ===========================
- **Inherits:** :ref:`SkeletonModification2D<class_SkeletonModification2D>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
- A modification that uses CCDIK to manipulate a series of bones to reach a target in 2D.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- This :ref:`SkeletonModification2D<class_SkeletonModification2D>` uses an algorithm called Cyclic Coordinate Descent Inverse Kinematics, or CCDIK, to manipulate a chain of bones in a :ref:`Skeleton2D<class_Skeleton2D>` so it reaches a defined target.
- CCDIK works by rotating a set of bones, typically called a "bone chain", on a single axis. Each bone is rotated to face the target from the tip (by default), which over a chain of bones allow it to rotate properly to reach the target. Because the bones only rotate on a single axis, CCDIK *can* look more robotic than other IK solvers.
- \ **Note:** The CCDIK modifier has ``ccdik_joints``, which are the data objects that hold the data for each joint in the CCDIK chain. This is different from a bone! CCDIK joints hold the data needed for each bone in the bone chain used by CCDIK.
- CCDIK also fully supports angle constraints, allowing for more control over how a solution is met.
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. table::
- :widths: auto
- +---------------------------------+----------------------------------------------------------------------------------------------------+------------------+
- | :ref:`int<class_int>` | :ref:`ccdik_data_chain_length<class_SkeletonModification2DCCDIK_property_ccdik_data_chain_length>` | ``0`` |
- +---------------------------------+----------------------------------------------------------------------------------------------------+------------------+
- | :ref:`NodePath<class_NodePath>` | :ref:`target_nodepath<class_SkeletonModification2DCCDIK_property_target_nodepath>` | ``NodePath("")`` |
- +---------------------------------+----------------------------------------------------------------------------------------------------+------------------+
- | :ref:`NodePath<class_NodePath>` | :ref:`tip_nodepath<class_SkeletonModification2DCCDIK_property_tip_nodepath>` | ``NodePath("")`` |
- +---------------------------------+----------------------------------------------------------------------------------------------------+------------------+
- .. rst-class:: classref-reftable-group
- Methods
- -------
- .. table::
- :widths: auto
- +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`NodePath<class_NodePath>` | :ref:`get_ccdik_joint_bone2d_node<class_SkeletonModification2DCCDIK_method_get_ccdik_joint_bone2d_node>` **(** :ref:`int<class_int>` joint_idx **)** |const| |
- +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_ccdik_joint_bone_index<class_SkeletonModification2DCCDIK_method_get_ccdik_joint_bone_index>` **(** :ref:`int<class_int>` joint_idx **)** |const| |
- +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`get_ccdik_joint_constraint_angle_invert<class_SkeletonModification2DCCDIK_method_get_ccdik_joint_constraint_angle_invert>` **(** :ref:`int<class_int>` joint_idx **)** |const| |
- +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_ccdik_joint_constraint_angle_max<class_SkeletonModification2DCCDIK_method_get_ccdik_joint_constraint_angle_max>` **(** :ref:`int<class_int>` joint_idx **)** |const| |
- +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_ccdik_joint_constraint_angle_min<class_SkeletonModification2DCCDIK_method_get_ccdik_joint_constraint_angle_min>` **(** :ref:`int<class_int>` joint_idx **)** |const| |
- +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`get_ccdik_joint_enable_constraint<class_SkeletonModification2DCCDIK_method_get_ccdik_joint_enable_constraint>` **(** :ref:`int<class_int>` joint_idx **)** |const| |
- +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`get_ccdik_joint_rotate_from_joint<class_SkeletonModification2DCCDIK_method_get_ccdik_joint_rotate_from_joint>` **(** :ref:`int<class_int>` joint_idx **)** |const| |
- +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_ccdik_joint_bone2d_node<class_SkeletonModification2DCCDIK_method_set_ccdik_joint_bone2d_node>` **(** :ref:`int<class_int>` joint_idx, :ref:`NodePath<class_NodePath>` bone2d_nodepath **)** |
- +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_ccdik_joint_bone_index<class_SkeletonModification2DCCDIK_method_set_ccdik_joint_bone_index>` **(** :ref:`int<class_int>` joint_idx, :ref:`int<class_int>` bone_idx **)** |
- +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_ccdik_joint_constraint_angle_invert<class_SkeletonModification2DCCDIK_method_set_ccdik_joint_constraint_angle_invert>` **(** :ref:`int<class_int>` joint_idx, :ref:`bool<class_bool>` invert **)** |
- +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_ccdik_joint_constraint_angle_max<class_SkeletonModification2DCCDIK_method_set_ccdik_joint_constraint_angle_max>` **(** :ref:`int<class_int>` joint_idx, :ref:`float<class_float>` angle_max **)** |
- +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_ccdik_joint_constraint_angle_min<class_SkeletonModification2DCCDIK_method_set_ccdik_joint_constraint_angle_min>` **(** :ref:`int<class_int>` joint_idx, :ref:`float<class_float>` angle_min **)** |
- +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_ccdik_joint_enable_constraint<class_SkeletonModification2DCCDIK_method_set_ccdik_joint_enable_constraint>` **(** :ref:`int<class_int>` joint_idx, :ref:`bool<class_bool>` enable_constraint **)** |
- +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_ccdik_joint_rotate_from_joint<class_SkeletonModification2DCCDIK_method_set_ccdik_joint_rotate_from_joint>` **(** :ref:`int<class_int>` joint_idx, :ref:`bool<class_bool>` rotate_from_joint **)** |
- +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Property Descriptions
- ---------------------
- .. _class_SkeletonModification2DCCDIK_property_ccdik_data_chain_length:
- .. rst-class:: classref-property
- :ref:`int<class_int>` **ccdik_data_chain_length** = ``0``
- .. rst-class:: classref-property-setget
- - void **set_ccdik_data_chain_length** **(** :ref:`int<class_int>` value **)**
- - :ref:`int<class_int>` **get_ccdik_data_chain_length** **(** **)**
- The number of CCDIK joints in the CCDIK modification.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SkeletonModification2DCCDIK_property_target_nodepath:
- .. rst-class:: classref-property
- :ref:`NodePath<class_NodePath>` **target_nodepath** = ``NodePath("")``
- .. rst-class:: classref-property-setget
- - void **set_target_node** **(** :ref:`NodePath<class_NodePath>` value **)**
- - :ref:`NodePath<class_NodePath>` **get_target_node** **(** **)**
- The NodePath to the node that is the target for the CCDIK modification. This node is what the CCDIK chain will attempt to rotate the bone chain to.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SkeletonModification2DCCDIK_property_tip_nodepath:
- .. rst-class:: classref-property
- :ref:`NodePath<class_NodePath>` **tip_nodepath** = ``NodePath("")``
- .. rst-class:: classref-property-setget
- - void **set_tip_node** **(** :ref:`NodePath<class_NodePath>` value **)**
- - :ref:`NodePath<class_NodePath>` **get_tip_node** **(** **)**
- The end position of the CCDIK chain. Typically, this should be a child of a :ref:`Bone2D<class_Bone2D>` node attached to the final :ref:`Bone2D<class_Bone2D>` in the CCDIK chain.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _class_SkeletonModification2DCCDIK_method_get_ccdik_joint_bone2d_node:
- .. rst-class:: classref-method
- :ref:`NodePath<class_NodePath>` **get_ccdik_joint_bone2d_node** **(** :ref:`int<class_int>` joint_idx **)** |const|
- Returns the :ref:`Bone2D<class_Bone2D>` node assigned to the CCDIK joint at ``joint_idx``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SkeletonModification2DCCDIK_method_get_ccdik_joint_bone_index:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **get_ccdik_joint_bone_index** **(** :ref:`int<class_int>` joint_idx **)** |const|
- Returns the index of the :ref:`Bone2D<class_Bone2D>` node assigned to the CCDIK joint at ``joint_idx``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SkeletonModification2DCCDIK_method_get_ccdik_joint_constraint_angle_invert:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **get_ccdik_joint_constraint_angle_invert** **(** :ref:`int<class_int>` joint_idx **)** |const|
- Returns whether the CCDIK joint at ``joint_idx`` uses an inverted joint constraint. See :ref:`set_ccdik_joint_constraint_angle_invert<class_SkeletonModification2DCCDIK_method_set_ccdik_joint_constraint_angle_invert>` for details.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SkeletonModification2DCCDIK_method_get_ccdik_joint_constraint_angle_max:
- .. rst-class:: classref-method
- :ref:`float<class_float>` **get_ccdik_joint_constraint_angle_max** **(** :ref:`int<class_int>` joint_idx **)** |const|
- Returns the maximum angle constraint for the joint at ``joint_idx``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SkeletonModification2DCCDIK_method_get_ccdik_joint_constraint_angle_min:
- .. rst-class:: classref-method
- :ref:`float<class_float>` **get_ccdik_joint_constraint_angle_min** **(** :ref:`int<class_int>` joint_idx **)** |const|
- Returns the minimum angle constraint for the joint at ``joint_idx``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SkeletonModification2DCCDIK_method_get_ccdik_joint_enable_constraint:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **get_ccdik_joint_enable_constraint** **(** :ref:`int<class_int>` joint_idx **)** |const|
- Returns whether angle constraints on the CCDIK joint at ``joint_idx`` are enabled.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SkeletonModification2DCCDIK_method_get_ccdik_joint_rotate_from_joint:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **get_ccdik_joint_rotate_from_joint** **(** :ref:`int<class_int>` joint_idx **)** |const|
- Returns whether the joint at ``joint_idx`` is set to rotate from the joint, ``true``, or to rotate from the tip, ``false``. The default is to rotate from the tip.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SkeletonModification2DCCDIK_method_set_ccdik_joint_bone2d_node:
- .. rst-class:: classref-method
- void **set_ccdik_joint_bone2d_node** **(** :ref:`int<class_int>` joint_idx, :ref:`NodePath<class_NodePath>` bone2d_nodepath **)**
- Sets the :ref:`Bone2D<class_Bone2D>` node assigned to the CCDIK joint at ``joint_idx``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SkeletonModification2DCCDIK_method_set_ccdik_joint_bone_index:
- .. rst-class:: classref-method
- void **set_ccdik_joint_bone_index** **(** :ref:`int<class_int>` joint_idx, :ref:`int<class_int>` bone_idx **)**
- Sets the bone index, ``bone_idx``, of the CCDIK joint at ``joint_idx``. When possible, this will also update the ``bone2d_node`` of the CCDIK joint based on data provided by the linked skeleton.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SkeletonModification2DCCDIK_method_set_ccdik_joint_constraint_angle_invert:
- .. rst-class:: classref-method
- void **set_ccdik_joint_constraint_angle_invert** **(** :ref:`int<class_int>` joint_idx, :ref:`bool<class_bool>` invert **)**
- Sets whether the CCDIK joint at ``joint_idx`` uses an inverted joint constraint.
- An inverted joint constraint only constraints the CCDIK joint to the angles *outside of* the inputted minimum and maximum angles. For this reason, it is referred to as an inverted joint constraint, as it constraints the joint to the outside of the inputted values.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SkeletonModification2DCCDIK_method_set_ccdik_joint_constraint_angle_max:
- .. rst-class:: classref-method
- void **set_ccdik_joint_constraint_angle_max** **(** :ref:`int<class_int>` joint_idx, :ref:`float<class_float>` angle_max **)**
- Sets the maximum angle constraint for the joint at ``joint_idx``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SkeletonModification2DCCDIK_method_set_ccdik_joint_constraint_angle_min:
- .. rst-class:: classref-method
- void **set_ccdik_joint_constraint_angle_min** **(** :ref:`int<class_int>` joint_idx, :ref:`float<class_float>` angle_min **)**
- Sets the minimum angle constraint for the joint at ``joint_idx``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SkeletonModification2DCCDIK_method_set_ccdik_joint_enable_constraint:
- .. rst-class:: classref-method
- void **set_ccdik_joint_enable_constraint** **(** :ref:`int<class_int>` joint_idx, :ref:`bool<class_bool>` enable_constraint **)**
- Determines whether angle constraints on the CCDIK joint at ``joint_idx`` are enabled. When ``true``, constraints will be enabled and taken into account when solving.
- .. rst-class:: classref-item-separator
- ----
- .. _class_SkeletonModification2DCCDIK_method_set_ccdik_joint_rotate_from_joint:
- .. rst-class:: classref-method
- void **set_ccdik_joint_rotate_from_joint** **(** :ref:`int<class_int>` joint_idx, :ref:`bool<class_bool>` rotate_from_joint **)**
- Sets whether the joint at ``joint_idx`` is set to rotate from the joint, ``true``, or to rotate from the tip, ``false``.
- .. |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.)`
|