Table of Contents

Class SkeletonModification2DCcdik

Namespace
Godot
Assembly
GodotSharp.dll

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.

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.

[GodotClassName("SkeletonModification2DCCDIK")]
public class SkeletonModification2DCcdik : SkeletonModification2D, IDisposable
Inheritance
SkeletonModification2DCcdik
Implements
Inherited Members

Constructors

SkeletonModification2DCcdik()

public SkeletonModification2DCcdik()

Properties

CcdikDataChainLength

The number of CCDIK joints in the CCDIK modification.

public int CcdikDataChainLength { get; set; }

Property Value

int

TargetNodePath

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.

public NodePath TargetNodePath { get; set; }

Property Value

NodePath

TipNodePath

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.

public NodePath TipNodePath { get; set; }

Property Value

NodePath

Methods

GetCcdikJointBone2DNode(int)

Returns the Bone2D node assigned to the CCDIK joint at jointIdx.

public NodePath GetCcdikJointBone2DNode(int jointIdx)

Parameters

jointIdx int

Returns

NodePath

GetCcdikJointBoneIndex(int)

Returns the index of the Bone2D node assigned to the CCDIK joint at jointIdx.

public int GetCcdikJointBoneIndex(int jointIdx)

Parameters

jointIdx int

Returns

int

GetCcdikJointConstraintAngleInvert(int)

Returns whether the CCDIK joint at jointIdx uses an inverted joint constraint. See SetCcdikJointConstraintAngleInvert(int, bool) for details.

public bool GetCcdikJointConstraintAngleInvert(int jointIdx)

Parameters

jointIdx int

Returns

bool

GetCcdikJointConstraintAngleMax(int)

Returns the maximum angle constraint for the joint at jointIdx.

public float GetCcdikJointConstraintAngleMax(int jointIdx)

Parameters

jointIdx int

Returns

float

GetCcdikJointConstraintAngleMin(int)

Returns the minimum angle constraint for the joint at jointIdx.

public float GetCcdikJointConstraintAngleMin(int jointIdx)

Parameters

jointIdx int

Returns

float

GetCcdikJointEnableConstraint(int)

Returns whether angle constraints on the CCDIK joint at jointIdx are enabled.

public bool GetCcdikJointEnableConstraint(int jointIdx)

Parameters

jointIdx int

Returns

bool

GetCcdikJointRotateFromJoint(int)

Returns whether the joint at jointIdx is set to rotate from the joint, true, or to rotate from the tip, false. The default is to rotate from the tip.

public bool GetCcdikJointRotateFromJoint(int jointIdx)

Parameters

jointIdx int

Returns

bool

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

SetCcdikJointBone2DNode(int, NodePath)

Sets the Bone2D node assigned to the CCDIK joint at jointIdx.

public void SetCcdikJointBone2DNode(int jointIdx, NodePath bone2DNodePath)

Parameters

jointIdx int
bone2DNodePath NodePath

SetCcdikJointBoneIndex(int, int)

Sets the bone index, boneIdx, of the CCDIK joint at jointIdx. When possible, this will also update the bone2d_node of the CCDIK joint based on data provided by the linked skeleton.

public void SetCcdikJointBoneIndex(int jointIdx, int boneIdx)

Parameters

jointIdx int
boneIdx int

SetCcdikJointConstraintAngleInvert(int, bool)

Sets whether the CCDIK joint at jointIdx 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.

public void SetCcdikJointConstraintAngleInvert(int jointIdx, bool invert)

Parameters

jointIdx int
invert bool

SetCcdikJointConstraintAngleMax(int, float)

Sets the maximum angle constraint for the joint at jointIdx.

public void SetCcdikJointConstraintAngleMax(int jointIdx, float angleMax)

Parameters

jointIdx int
angleMax float

SetCcdikJointConstraintAngleMin(int, float)

Sets the minimum angle constraint for the joint at jointIdx.

public void SetCcdikJointConstraintAngleMin(int jointIdx, float angleMin)

Parameters

jointIdx int
angleMin float

SetCcdikJointEnableConstraint(int, bool)

Determines whether angle constraints on the CCDIK joint at jointIdx are enabled. When true, constraints will be enabled and taken into account when solving.

public void SetCcdikJointEnableConstraint(int jointIdx, bool enableConstraint)

Parameters

jointIdx int
enableConstraint bool

SetCcdikJointRotateFromJoint(int, bool)

Sets whether the joint at jointIdx is set to rotate from the joint, true, or to rotate from the tip, false.

public void SetCcdikJointRotateFromJoint(int jointIdx, bool rotateFromJoint)

Parameters

jointIdx int
rotateFromJoint bool