Table of Contents

Class SkeletonModification2DTwoBoneIK

Namespace
Godot
Assembly
GodotSharp.dll

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.

public class SkeletonModification2DTwoBoneIK : SkeletonModification2D, IDisposable
Inheritance
SkeletonModification2DTwoBoneIK
Implements
Inherited Members

Constructors

SkeletonModification2DTwoBoneIK()

public SkeletonModification2DTwoBoneIK()

Properties

FlipBendDirection

If true, the bones in the modification will blend outward as opposed to inwards when contracting. If false, the bones will bend inwards when contracting.

public bool FlipBendDirection { get; set; }

Property Value

bool

TargetMaximumDistance

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 0, the modification will solve without distance constraints.

public float TargetMaximumDistance { get; set; }

Property Value

float

TargetMinimumDistance

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 0, the modification will solve without distance constraints.

public float TargetMinimumDistance { get; set; }

Property Value

float

TargetNodePath

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.

public NodePath TargetNodePath { get; set; }

Property Value

NodePath

Methods

GetJointOneBone2DNode()

Returns the Bone2D node that is being used as the first bone in the TwoBoneIK modification.

public NodePath GetJointOneBone2DNode()

Returns

NodePath

GetJointOneBoneIdx()

Returns the index of the Bone2D node that is being used as the first bone in the TwoBoneIK modification.

public int GetJointOneBoneIdx()

Returns

int

GetJointTwoBone2DNode()

Returns the Bone2D node that is being used as the second bone in the TwoBoneIK modification.

public NodePath GetJointTwoBone2DNode()

Returns

NodePath

GetJointTwoBoneIdx()

Returns the index of the Bone2D node that is being used as the second bone in the TwoBoneIK modification.

public int GetJointTwoBoneIdx()

Returns

int

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

SetJointOneBone2DNode(NodePath)

Sets the Bone2D node that is being used as the first bone in the TwoBoneIK modification.

public void SetJointOneBone2DNode(NodePath bone2DNode)

Parameters

bone2DNode NodePath

SetJointOneBoneIdx(int)

Sets the index of the Bone2D node that is being used as the first bone in the TwoBoneIK modification.

public void SetJointOneBoneIdx(int boneIdx)

Parameters

boneIdx int

SetJointTwoBone2DNode(NodePath)

Sets the Bone2D node that is being used as the second bone in the TwoBoneIK modification.

public void SetJointTwoBone2DNode(NodePath bone2DNode)

Parameters

bone2DNode NodePath

SetJointTwoBoneIdx(int)

Sets the index of the Bone2D node that is being used as the second bone in the TwoBoneIK modification.

public void SetJointTwoBoneIdx(int boneIdx)

Parameters

boneIdx int