0.2.0-dev Download ZIP
133 lines ·6.9 KB Raw
| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="SkeletonModification2DCCDIK" inherits="SkeletonModification2D" api_type="core" experimental="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | A modification that uses CCDIK to manipulate a series of bones to reach a target in 2D. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | This [SkeletonModification2D] uses an algorithm called Cyclic Coordinate Descent Inverse Kinematics, or CCDIK, to manipulate a chain of bones in a [Skeleton2D] so it reaches a defined target. |
| 8 | 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 [i]can[/i] look more robotic than other IK solvers. |
| 9 | [b]Note:[/b] The CCDIK modifier has [code]ccdik_joints[/code], 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. |
| 10 | CCDIK also fully supports angle constraints, allowing for more control over how a solution is met. |
| 11 | </description> |
| 12 | <tutorials> |
| 13 | </tutorials> |
| 14 | <methods> |
| 15 | <method name="get_ccdik_joint_bone2d_node" qualifiers="const"> |
| 16 | <return type="NodePath" /> |
| 17 | <param index="0" name="joint_idx" type="int" /> |
| 18 | <description> |
| 19 | Returns the [Bone2D] node assigned to the CCDIK joint at [param joint_idx]. |
| 20 | </description> |
| 21 | </method> |
| 22 | <method name="get_ccdik_joint_bone_index" qualifiers="const"> |
| 23 | <return type="int" /> |
| 24 | <param index="0" name="joint_idx" type="int" /> |
| 25 | <description> |
| 26 | Returns the index of the [Bone2D] node assigned to the CCDIK joint at [param joint_idx]. |
| 27 | </description> |
| 28 | </method> |
| 29 | <method name="get_ccdik_joint_constraint_angle_invert" qualifiers="const"> |
| 30 | <return type="bool" /> |
| 31 | <param index="0" name="joint_idx" type="int" /> |
| 32 | <description> |
| 33 | Returns whether the CCDIK joint at [param joint_idx] uses an inverted joint constraint. See [method set_ccdik_joint_constraint_angle_invert] for details. |
| 34 | </description> |
| 35 | </method> |
| 36 | <method name="get_ccdik_joint_constraint_angle_max" qualifiers="const"> |
| 37 | <return type="float" /> |
| 38 | <param index="0" name="joint_idx" type="int" /> |
| 39 | <description> |
| 40 | Returns the maximum angle constraint for the joint at [param joint_idx]. |
| 41 | </description> |
| 42 | </method> |
| 43 | <method name="get_ccdik_joint_constraint_angle_min" qualifiers="const"> |
| 44 | <return type="float" /> |
| 45 | <param index="0" name="joint_idx" type="int" /> |
| 46 | <description> |
| 47 | Returns the minimum angle constraint for the joint at [param joint_idx]. |
| 48 | </description> |
| 49 | </method> |
| 50 | <method name="get_ccdik_joint_enable_constraint" qualifiers="const"> |
| 51 | <return type="bool" /> |
| 52 | <param index="0" name="joint_idx" type="int" /> |
| 53 | <description> |
| 54 | Returns whether angle constraints on the CCDIK joint at [param joint_idx] are enabled. |
| 55 | </description> |
| 56 | </method> |
| 57 | <method name="get_ccdik_joint_rotate_from_joint" qualifiers="const"> |
| 58 | <return type="bool" /> |
| 59 | <param index="0" name="joint_idx" type="int" /> |
| 60 | <description> |
| 61 | Returns whether the joint at [param joint_idx] is set to rotate from the joint, [code]true[/code], or to rotate from the tip, [code]false[/code]. The default is to rotate from the tip. |
| 62 | </description> |
| 63 | </method> |
| 64 | <method name="set_ccdik_joint_bone2d_node"> |
| 65 | <return type="void" /> |
| 66 | <param index="0" name="joint_idx" type="int" /> |
| 67 | <param index="1" name="bone2d_nodepath" type="NodePath" /> |
| 68 | <description> |
| 69 | Sets the [Bone2D] node assigned to the CCDIK joint at [param joint_idx]. |
| 70 | </description> |
| 71 | </method> |
| 72 | <method name="set_ccdik_joint_bone_index"> |
| 73 | <return type="void" /> |
| 74 | <param index="0" name="joint_idx" type="int" /> |
| 75 | <param index="1" name="bone_idx" type="int" /> |
| 76 | <description> |
| 77 | Sets the bone index, [param bone_idx], of the CCDIK joint at [param joint_idx]. When possible, this will also update the [code]bone2d_node[/code] of the CCDIK joint based on data provided by the linked skeleton. |
| 78 | </description> |
| 79 | </method> |
| 80 | <method name="set_ccdik_joint_constraint_angle_invert"> |
| 81 | <return type="void" /> |
| 82 | <param index="0" name="joint_idx" type="int" /> |
| 83 | <param index="1" name="invert" type="bool" /> |
| 84 | <description> |
| 85 | Sets whether the CCDIK joint at [param joint_idx] uses an inverted joint constraint. |
| 86 | An inverted joint constraint only constraints the CCDIK joint to the angles [i]outside of[/i] 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. |
| 87 | </description> |
| 88 | </method> |
| 89 | <method name="set_ccdik_joint_constraint_angle_max"> |
| 90 | <return type="void" /> |
| 91 | <param index="0" name="joint_idx" type="int" /> |
| 92 | <param index="1" name="angle_max" type="float" /> |
| 93 | <description> |
| 94 | Sets the maximum angle constraint for the joint at [param joint_idx]. |
| 95 | </description> |
| 96 | </method> |
| 97 | <method name="set_ccdik_joint_constraint_angle_min"> |
| 98 | <return type="void" /> |
| 99 | <param index="0" name="joint_idx" type="int" /> |
| 100 | <param index="1" name="angle_min" type="float" /> |
| 101 | <description> |
| 102 | Sets the minimum angle constraint for the joint at [param joint_idx]. |
| 103 | </description> |
| 104 | </method> |
| 105 | <method name="set_ccdik_joint_enable_constraint"> |
| 106 | <return type="void" /> |
| 107 | <param index="0" name="joint_idx" type="int" /> |
| 108 | <param index="1" name="enable_constraint" type="bool" /> |
| 109 | <description> |
| 110 | Determines whether angle constraints on the CCDIK joint at [param joint_idx] are enabled. When [code]true[/code], constraints will be enabled and taken into account when solving. |
| 111 | </description> |
| 112 | </method> |
| 113 | <method name="set_ccdik_joint_rotate_from_joint"> |
| 114 | <return type="void" /> |
| 115 | <param index="0" name="joint_idx" type="int" /> |
| 116 | <param index="1" name="rotate_from_joint" type="bool" /> |
| 117 | <description> |
| 118 | Sets whether the joint at [param joint_idx] is set to rotate from the joint, [code]true[/code], or to rotate from the tip, [code]false[/code]. |
| 119 | </description> |
| 120 | </method> |
| 121 | </methods> |
| 122 | <members> |
| 123 | <member name="ccdik_data_chain_length" type="int" setter="set_ccdik_data_chain_length" getter="get_ccdik_data_chain_length" default="0"> |
| 124 | The number of CCDIK joints in the CCDIK modification. |
| 125 | </member> |
| 126 | <member name="target_nodepath" type="NodePath" setter="set_target_node" getter="get_target_node" default="NodePath("")"> |
| 127 | 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. |
| 128 | </member> |
| 129 | <member name="tip_nodepath" type="NodePath" setter="set_tip_node" getter="get_tip_node" default="NodePath("")"> |
| 130 | The end position of the CCDIK chain. Typically, this should be a child of a [Bone2D] node attached to the final [Bone2D] in the CCDIK chain. |
| 131 | </member> |
| 132 | </members> |
| 133 | </class> |