godot/doc/classes/SkeletonModification3DTwoBoneIK.xml

192 lines
9.3 KiB
XML
Raw Normal View History

New and improved IK system for Skeleton3D This PR and commit adds a new IK system for 3D with the Skeleton3D node that adds several new IK solvers, as well as additional changes and functionality for making bone manipulation in Godot easier. This work was sponsored by GSoC 2020 and TwistedTwigleg Full list of changes: * Adds a SkeletonModification3D resource * This resource is the base where all IK code is written and executed * Adds a SkeletonModificationStack3D resource * This node oversees the execution of the modifications and acts as a bridge of sorts for the modifications to the Skeleton3D node * Adds SkeletonModification3D resources for LookAt, CCDIK, FABRIK, Jiggle, and TwoBoneIK * Each modification is in it's own file * Several changes to Skeletons, listed below: * Added local_pose_override, which acts just like global_pose_override but keeps bone-child relationships intract * So if you move a bone using local_pose_override, all of the bones that are children will also be moved. This is different than global_pose_override, which only affects the individual bone * Internally bones keep track of their children. This removes the need of a processing list, makes it possible to update just a few select bones at a time, and makes it easier to traverse down the bone chain * Additional functions added for converting from world transform to global poses, global poses to local poses, and all the same changes but backwards (local to global, global to world). This makes it much easier to work with bone transforms without needing to think too much about how to convert them. * New signal added, bone_pose_changed, that can be used to tell if a specific bone changed its transform. Needed for BoneAttachment3D * Added functions for getting the forward position of a bone * BoneAttachment3D node refactored heavily * BoneAttachment3D node is now completely standalone in its functionality. * This makes the code easier and less interconnected, as well as allowing them to function properly without being direct children of Skeleton3D nodes * BoneAttachment3D now can be set either using the index or the bone name. * BoneAttachment3D nodes can now set the bone transform instead of just following it. This is disabled by default for compatibility * BoneAttachment3D now shows a warning when not configured correctly * Added rotate_to_align function in Basis * Added class reference documentation for all changes
2020-08-03 21:22:34 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
<class name="SkeletonModification3DTwoBoneIK" inherits="SkeletonModification3D" version="4.0">
<brief_description>
A modification that moves two bones to reach the target.
</brief_description>
<description>
This [SkeletonModification3D] uses an algorithm typically called TwoBoneIK. This algorithm works by leveraging the law of cosigns 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 verticies of the triangle. Because the algorithm works by making a triangle, it can only opperate 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 [SkeletonModification3DFABRIK], but gives similar, natural looking results.
A [Node3D]-based node can be used to define the pole, or bend direction, allowing control over which direction the joint takes when bending to reach the target when the target is within reach.
</description>
<tutorials>
</tutorials>
<methods>
<method name="get_auto_calculate_joint_length" qualifiers="const">
<return type="bool" />
<description>
Returns whether the TwoBoneIK modification will attempt to autocalculate the lengths of the two bones.
</description>
</method>
<method name="get_joint_one_bone_idx" qualifiers="const">
<return type="int" />
<description>
Returns the bone index of the first bone in the TwoBoneIK modification.
</description>
</method>
<method name="get_joint_one_bone_name" qualifiers="const">
<return type="String" />
<description>
Returns the name of the first bone in the TwoBoneIK modification.
</description>
</method>
<method name="get_joint_one_length" qualifiers="const">
<return type="float" />
<description>
Returns the length of the first bone in the TwoBoneIK modification.
</description>
</method>
<method name="get_joint_one_roll" qualifiers="const">
<return type="float" />
<description>
Returns the amount of roll/twist applied to the first bone in the TwoBoneIK modification.
</description>
</method>
<method name="get_joint_two_bone_idx" qualifiers="const">
<return type="int" />
<description>
Returns the bone index of the second bone in the TwoBoneIK modification.
</description>
</method>
<method name="get_joint_two_bone_name" qualifiers="const">
<return type="String" />
<description>
Returns the name of the second bone in the TwoBoneIK modification.
</description>
</method>
<method name="get_joint_two_length" qualifiers="const">
<return type="float" />
<description>
Returns the length of the second bone in the TwoBoneIK modification.
</description>
</method>
<method name="get_joint_two_roll" qualifiers="const">
<return type="float" />
<description>
Returns the amount of roll/twist applied to the second bone in the TwoBoneIK modification.
</description>
</method>
<method name="get_pole_node" qualifiers="const">
<return type="NodePath" />
<description>
Returns the node that is being used as the pole node for the TwoBoneIK modification, if a pole node has been set.
</description>
</method>
<method name="get_tip_node" qualifiers="const">
<return type="NodePath" />
<description>
Returns the node that is being used to calculate the tip position of the second bone in the TwoBoneIK modification, if a tip node has been set.
</description>
</method>
<method name="get_use_pole_node" qualifiers="const">
<return type="bool" />
<description>
Returns whether the TwoBoneIK modification will attempt to use the pole node to figure out which direction to bend, if a pole node has been set.
</description>
</method>
<method name="get_use_tip_node" qualifiers="const">
<return type="bool" />
<description>
Returns whether the TwoBoneIK modification will attempt to use the tip node to figure out the length and position of the tip of the second bone.
</description>
</method>
<method name="set_auto_calculate_joint_length">
<return type="void" />
<argument index="0" name="auto_calculate_joint_length" type="bool" />
<description>
If true, the TwoBoneIK modification will attempt to autocalculate the lengths of the bones being used. The first bone will be calculated by using the distance from the origin of the first bone to the origin of the second bone.
The second bone will be calculated either using the tip node if that setting is enabled, or by using the distances of the second bone's children. If the tip node is not enabled and the bone has no children, then the length cannot be autocalculated. In this case, the length will either have to be manually inputted or a tip node used to calculate the length.
</description>
</method>
<method name="set_joint_one_bone_idx">
<return type="void" />
<argument index="0" name="bone_idx" type="int" />
<description>
Sets the bone index, [code]bone_index[/code], of the first bone. When possible, this will also update the [code]bone_name[/code] of the first bone based on data provided by the [Skeleton3D].
</description>
</method>
<method name="set_joint_one_bone_name">
<return type="void" />
<argument index="0" name="bone_name" type="String" />
<description>
Sets the bone name, [code]bone_name[/code], of the first bone. When possible, this will also update the [code]bone_index[/code] of the first bone based on data provided by the [Skeleton3D].
</description>
</method>
<method name="set_joint_one_length">
<return type="void" />
<argument index="0" name="bone_length" type="float" />
<description>
Sets the length of the first bone in the TwoBoneIK modification.
</description>
</method>
<method name="set_joint_one_roll">
<return type="void" />
<argument index="0" name="roll" type="float" />
<description>
Sets the amount of roll/twist applied to the first bone in the TwoBoneIK modification.
</description>
</method>
<method name="set_joint_two_bone_idx">
<return type="void" />
<argument index="0" name="bone_idx" type="int" />
<description>
Sets the bone index, [code]bone_index[/code], of the second bone. When possible, this will also update the [code]bone_name[/code] of the second bone based on data provided by the [Skeleton3D].
</description>
</method>
<method name="set_joint_two_bone_name">
<return type="void" />
<argument index="0" name="bone_name" type="String" />
<description>
Sets the bone name, [code]bone_name[/code], of the second bone. When possible, this will also update the [code]bone_index[/code] of the second bone based on data provided by the [Skeleton3D].
</description>
</method>
<method name="set_joint_two_length">
<return type="void" />
<argument index="0" name="bone_length" type="float" />
<description>
Sets the length of the second bone in the TwoBoneIK modification.
</description>
</method>
<method name="set_joint_two_roll">
<return type="void" />
<argument index="0" name="roll" type="float" />
<description>
Sets the amount of roll/twist applied to the second bone in the TwoBoneIK modification.
</description>
</method>
<method name="set_pole_node">
<return type="void" />
<argument index="0" name="pole_nodepath" type="NodePath" />
<description>
Sets the node to be used as the for the pole of the TwoBoneIK. When a node is set and the modification is set to use the pole node, the TwoBoneIK modification will bend the nodes in the direction towards this node when the bones need to bend.
</description>
</method>
<method name="set_tip_node">
<return type="void" />
<argument index="0" name="tip_nodepath" type="NodePath" />
<description>
Sets the node to be used as the tip for the second bone. This is used to calculate the length and position of the end of the second bone in the TwoBoneIK modification.
[b]Note:[/b] The tip node should generally be a child node of a [BoneAttachment3D] node attached to the second bone, with the child node being offset so it is at the end of the bone.
</description>
</method>
<method name="set_use_pole_node">
<return type="void" />
<argument index="0" name="use_pole_node" type="bool" />
<description>
When [code]true[/code], the TwoBoneIK modification will bend the bones towards the pole node, if one has been set. This gives control over the direction the TwoBoneIK solver will bend, which is helpful for joints like elbows that only bend in certain directions.
</description>
</method>
<method name="set_use_tip_node">
<return type="void" />
<argument index="0" name="use_tip_node" type="bool" />
<description>
When [code]true[/code], the TwoBoneIK modification will use the tip node to calculate the distance and position of the end/tip of the second bone. This is the most stable solution for knowing the tip position and length of the second bone.
</description>
</method>
</methods>
<members>
<member name="target_nodepath" type="NodePath" setter="set_target_node" getter="get_target_node" default="NodePath(&quot;&quot;)">
The NodePath to the node that is the target for the TwoBoneIK modification. This node is what the modification will attempt to rotate the bones to reach.
</member>
</members>
</class>