mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 20:23:53 +00:00
81 lines
4.5 KiB
XML
81 lines
4.5 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<class name="SkeletonModification2DTwoBoneIK" inherits="SkeletonModification2D" experimental="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
|
|
<brief_description>
|
|
A modification that rotates two bones using the law of cosines to reach the target.
|
|
</brief_description>
|
|
<description>
|
|
This [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 [SkeletonModification2DFABRIK], but gives similar, natural looking results.
|
|
</description>
|
|
<tutorials>
|
|
</tutorials>
|
|
<methods>
|
|
<method name="get_joint_one_bone2d_node" qualifiers="const">
|
|
<return type="NodePath" />
|
|
<description>
|
|
Returns the [Bone2D] node that is being used as the first bone in the TwoBoneIK modification.
|
|
</description>
|
|
</method>
|
|
<method name="get_joint_one_bone_idx" qualifiers="const">
|
|
<return type="int" />
|
|
<description>
|
|
Returns the index of the [Bone2D] node that is being used as the first bone in the TwoBoneIK modification.
|
|
</description>
|
|
</method>
|
|
<method name="get_joint_two_bone2d_node" qualifiers="const">
|
|
<return type="NodePath" />
|
|
<description>
|
|
Returns the [Bone2D] node that is being used as the second bone in the TwoBoneIK modification.
|
|
</description>
|
|
</method>
|
|
<method name="get_joint_two_bone_idx" qualifiers="const">
|
|
<return type="int" />
|
|
<description>
|
|
Returns the index of the [Bone2D] node that is being used as the second bone in the TwoBoneIK modification.
|
|
</description>
|
|
</method>
|
|
<method name="set_joint_one_bone2d_node">
|
|
<return type="void" />
|
|
<param index="0" name="bone2d_node" type="NodePath" />
|
|
<description>
|
|
Sets the [Bone2D] node that is being used as the first bone in the TwoBoneIK modification.
|
|
</description>
|
|
</method>
|
|
<method name="set_joint_one_bone_idx">
|
|
<return type="void" />
|
|
<param index="0" name="bone_idx" type="int" />
|
|
<description>
|
|
Sets the index of the [Bone2D] node that is being used as the first bone in the TwoBoneIK modification.
|
|
</description>
|
|
</method>
|
|
<method name="set_joint_two_bone2d_node">
|
|
<return type="void" />
|
|
<param index="0" name="bone2d_node" type="NodePath" />
|
|
<description>
|
|
Sets the [Bone2D] node that is being used as the second bone in the TwoBoneIK modification.
|
|
</description>
|
|
</method>
|
|
<method name="set_joint_two_bone_idx">
|
|
<return type="void" />
|
|
<param index="0" name="bone_idx" type="int" />
|
|
<description>
|
|
Sets the index of the [Bone2D] node that is being used as the second bone in the TwoBoneIK modification.
|
|
</description>
|
|
</method>
|
|
</methods>
|
|
<members>
|
|
<member name="flip_bend_direction" type="bool" setter="set_flip_bend_direction" getter="get_flip_bend_direction" default="false">
|
|
If [code]true[/code], the bones in the modification will blend outward as opposed to inwards when contracting. If [code]false[/code], the bones will bend inwards when contracting.
|
|
</member>
|
|
<member name="target_maximum_distance" type="float" setter="set_target_maximum_distance" getter="get_target_maximum_distance" default="0.0">
|
|
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 [code]0[/code], the modification will solve without distance constraints.
|
|
</member>
|
|
<member name="target_minimum_distance" type="float" setter="set_target_minimum_distance" getter="get_target_minimum_distance" default="0.0">
|
|
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 [code]0[/code], the modification will solve without distance constraints.
|
|
</member>
|
|
<member name="target_nodepath" type="NodePath" setter="set_target_node" getter="get_target_node" default="NodePath("")">
|
|
The NodePath to the node that is the target for the TwoBoneIK modification. This node is what the modification will use when bending the [Bone2D] nodes.
|
|
</member>
|
|
</members>
|
|
</class>
|