Files
godot-docs/classes/class_skeletonmodification3dccdik.rst
2022-08-31 15:18:54 +02:00

260 lines
18 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/SkeletonModification3DCCDIK.xml.
.. _class_SkeletonModification3DCCDIK:
SkeletonModification3DCCDIK
===========================
**Inherits:** :ref:`SkeletonModification3D<class_SkeletonModification3D>` **<** :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.
Description
-----------
This :ref:`SkeletonModification3D<class_SkeletonModification3D>` uses an algorithm called Cyclic Coordinate Descent Inverse Kinematics, or CCDIK, to manipulate a chain of bones in a Skeleton 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.
Properties
----------
+---------------------------------+----------------------------------------------------------------------------------------------------+------------------+
| :ref:`int<class_int>` | :ref:`ccdik_data_chain_length<class_SkeletonModification3DCCDIK_property_ccdik_data_chain_length>` | ``0`` |
+---------------------------------+----------------------------------------------------------------------------------------------------+------------------+
| :ref:`bool<class_bool>` | :ref:`high_quality_solve<class_SkeletonModification3DCCDIK_property_high_quality_solve>` | ``true`` |
+---------------------------------+----------------------------------------------------------------------------------------------------+------------------+
| :ref:`NodePath<class_NodePath>` | :ref:`target_nodepath<class_SkeletonModification3DCCDIK_property_target_nodepath>` | ``NodePath("")`` |
+---------------------------------+----------------------------------------------------------------------------------------------------+------------------+
| :ref:`NodePath<class_NodePath>` | :ref:`tip_nodepath<class_SkeletonModification3DCCDIK_property_tip_nodepath>` | ``NodePath("")`` |
+---------------------------------+----------------------------------------------------------------------------------------------------+------------------+
Methods
-------
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_ccdik_joint_bone_index<class_SkeletonModification3DCCDIK_method_get_ccdik_joint_bone_index>` **(** :ref:`int<class_int>` joint_idx **)** |const| |
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_ccdik_joint_bone_name<class_SkeletonModification3DCCDIK_method_get_ccdik_joint_bone_name>` **(** :ref:`int<class_int>` joint_idx **)** |const| |
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_ccdik_joint_ccdik_axis<class_SkeletonModification3DCCDIK_method_get_ccdik_joint_ccdik_axis>` **(** :ref:`int<class_int>` joint_idx **)** |const| |
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_ccdik_joint_constraint_angle_max<class_SkeletonModification3DCCDIK_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_SkeletonModification3DCCDIK_method_get_ccdik_joint_constraint_angle_min>` **(** :ref:`int<class_int>` joint_idx **)** |const| |
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`get_ccdik_joint_constraint_invert<class_SkeletonModification3DCCDIK_method_get_ccdik_joint_constraint_invert>` **(** :ref:`int<class_int>` joint_idx **)** |const| |
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`get_ccdik_joint_enable_joint_constraint<class_SkeletonModification3DCCDIK_method_get_ccdik_joint_enable_joint_constraint>` **(** :ref:`int<class_int>` joint_idx **)** |const| |
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_ccdik_joint_bone_index<class_SkeletonModification3DCCDIK_method_set_ccdik_joint_bone_index>` **(** :ref:`int<class_int>` joint_idx, :ref:`int<class_int>` bone_index **)** |
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_ccdik_joint_bone_name<class_SkeletonModification3DCCDIK_method_set_ccdik_joint_bone_name>` **(** :ref:`int<class_int>` joint_idx, :ref:`String<class_String>` bone_name **)** |
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_ccdik_joint_ccdik_axis<class_SkeletonModification3DCCDIK_method_set_ccdik_joint_ccdik_axis>` **(** :ref:`int<class_int>` joint_idx, :ref:`int<class_int>` axis **)** |
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_ccdik_joint_constraint_angle_max<class_SkeletonModification3DCCDIK_method_set_ccdik_joint_constraint_angle_max>` **(** :ref:`int<class_int>` joint_idx, :ref:`float<class_float>` max_angle **)** |
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_ccdik_joint_constraint_angle_min<class_SkeletonModification3DCCDIK_method_set_ccdik_joint_constraint_angle_min>` **(** :ref:`int<class_int>` joint_idx, :ref:`float<class_float>` min_angle **)** |
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_ccdik_joint_constraint_invert<class_SkeletonModification3DCCDIK_method_set_ccdik_joint_constraint_invert>` **(** :ref:`int<class_int>` joint_idx, :ref:`bool<class_bool>` invert **)** |
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_ccdik_joint_enable_joint_constraint<class_SkeletonModification3DCCDIK_method_set_ccdik_joint_enable_joint_constraint>` **(** :ref:`int<class_int>` joint_idx, :ref:`bool<class_bool>` enable **)** |
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Property Descriptions
---------------------
.. _class_SkeletonModification3DCCDIK_property_ccdik_data_chain_length:
- :ref:`int<class_int>` **ccdik_data_chain_length**
+-----------+------------------------------------+
| *Default* | ``0`` |
+-----------+------------------------------------+
| *Setter* | set_ccdik_data_chain_length(value) |
+-----------+------------------------------------+
| *Getter* | get_ccdik_data_chain_length() |
+-----------+------------------------------------+
The number of CCDIK joints in the CCDIK modification.
----
.. _class_SkeletonModification3DCCDIK_property_high_quality_solve:
- :ref:`bool<class_bool>` **high_quality_solve**
+-----------+-----------------------------------+
| *Default* | ``true`` |
+-----------+-----------------------------------+
| *Setter* | set_use_high_quality_solve(value) |
+-----------+-----------------------------------+
| *Getter* | get_use_high_quality_solve() |
+-----------+-----------------------------------+
When true, the CCDIK algorithm will perform a higher quality solve that returns more natural results. A high quality solve requires more computation power to solve though, and therefore can be disabled to save performance.
----
.. _class_SkeletonModification3DCCDIK_property_target_nodepath:
- :ref:`NodePath<class_NodePath>` **target_nodepath**
+-----------+------------------------+
| *Default* | ``NodePath("")`` |
+-----------+------------------------+
| *Setter* | set_target_node(value) |
+-----------+------------------------+
| *Getter* | 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.
----
.. _class_SkeletonModification3DCCDIK_property_tip_nodepath:
- :ref:`NodePath<class_NodePath>` **tip_nodepath**
+-----------+---------------------+
| *Default* | ``NodePath("")`` |
+-----------+---------------------+
| *Setter* | set_tip_node(value) |
+-----------+---------------------+
| *Getter* | get_tip_node() |
+-----------+---------------------+
The end position of the CCDIK chain. Typically, this should be a child of a :ref:`BoneAttachment3D<class_BoneAttachment3D>` node attached to the final bone in the CCDIK chain, where the child node is offset so it is at the end of the final bone.
Method Descriptions
-------------------
.. _class_SkeletonModification3DCCDIK_method_get_ccdik_joint_bone_index:
- :ref:`int<class_int>` **get_ccdik_joint_bone_index** **(** :ref:`int<class_int>` joint_idx **)** |const|
Returns the bone index of the bone assigned to the CCDIK joint at ``joint_idx``.
----
.. _class_SkeletonModification3DCCDIK_method_get_ccdik_joint_bone_name:
- :ref:`String<class_String>` **get_ccdik_joint_bone_name** **(** :ref:`int<class_int>` joint_idx **)** |const|
Returns the name of the bone that is assigned to the CCDIK joint at ``joint_idx``.
----
.. _class_SkeletonModification3DCCDIK_method_get_ccdik_joint_ccdik_axis:
- :ref:`int<class_int>` **get_ccdik_joint_ccdik_axis** **(** :ref:`int<class_int>` joint_idx **)** |const|
Returns the integer representing the joint axis of the CCDIK joint at ``joint_idx``.
----
.. _class_SkeletonModification3DCCDIK_method_get_ccdik_joint_constraint_angle_max:
- :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``. **Note:** This angle is in degrees!
----
.. _class_SkeletonModification3DCCDIK_method_get_ccdik_joint_constraint_angle_min:
- :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``. **Note:** This angle is in degrees!
----
.. _class_SkeletonModification3DCCDIK_method_get_ccdik_joint_constraint_invert:
- :ref:`bool<class_bool>` **get_ccdik_joint_constraint_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_invert<class_SkeletonModification3DCCDIK_method_set_ccdik_joint_constraint_invert>` for details.
----
.. _class_SkeletonModification3DCCDIK_method_get_ccdik_joint_enable_joint_constraint:
- :ref:`bool<class_bool>` **get_ccdik_joint_enable_joint_constraint** **(** :ref:`int<class_int>` joint_idx **)** |const|
Enables angle constraints to the CCDIK joint at ``joint_idx``.
----
.. _class_SkeletonModification3DCCDIK_method_set_ccdik_joint_bone_index:
- void **set_ccdik_joint_bone_index** **(** :ref:`int<class_int>` joint_idx, :ref:`int<class_int>` bone_index **)**
Sets the bone index, ``bone_index``, of the CCDIK joint at ``joint_idx``. When possible, this will also update the ``bone_name`` of the CCDIK joint based on data provided by the linked skeleton.
----
.. _class_SkeletonModification3DCCDIK_method_set_ccdik_joint_bone_name:
- void **set_ccdik_joint_bone_name** **(** :ref:`int<class_int>` joint_idx, :ref:`String<class_String>` bone_name **)**
Sets the bone name, ``bone_name``, of the CCDIK joint at ``joint_idx``. When possible, this will also update the ``bone_index`` of the CCDIK joint based on data provided by the linked skeleton.
----
.. _class_SkeletonModification3DCCDIK_method_set_ccdik_joint_ccdik_axis:
- void **set_ccdik_joint_ccdik_axis** **(** :ref:`int<class_int>` joint_idx, :ref:`int<class_int>` axis **)**
Sets the joint axis of the CCDIK joint at ``joint_idx`` to the passed-in joint axis, ``axis``.
----
.. _class_SkeletonModification3DCCDIK_method_set_ccdik_joint_constraint_angle_max:
- void **set_ccdik_joint_constraint_angle_max** **(** :ref:`int<class_int>` joint_idx, :ref:`float<class_float>` max_angle **)**
Sets the maximum angle constraint for the joint at ``joint_idx``. **Note:** This angle must be in radians!
----
.. _class_SkeletonModification3DCCDIK_method_set_ccdik_joint_constraint_angle_min:
- void **set_ccdik_joint_constraint_angle_min** **(** :ref:`int<class_int>` joint_idx, :ref:`float<class_float>` min_angle **)**
Sets the minimum angle constraint for the joint at ``joint_idx``. **Note:** This angle must be in radians!
----
.. _class_SkeletonModification3DCCDIK_method_set_ccdik_joint_constraint_invert:
- void **set_ccdik_joint_constraint_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.
----
.. _class_SkeletonModification3DCCDIK_method_set_ccdik_joint_enable_joint_constraint:
- void **set_ccdik_joint_enable_joint_constraint** **(** :ref:`int<class_int>` joint_idx, :ref:`bool<class_bool>` enable **)**
Sets whether joint constraints are enabled for the CCDIK joint at ``joint_idx``.
.. |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.)`